SyntaxError: require() of ES Module (node 19.4 & npm 9.2) Follow
Hi, I have a problem compiling less since the update to the new version of node and npm (in order to take into account a new syntax).
Whenever I modify a less file, the compilation returns me the same problem.
How can I solve this problem on macosx ?
/Users/aureliengerits/.npm-global/lib/node_modules/lessc/node_modules/less/bin/lessc --source-map --source-map-rootpath=. --source-map-basepath=/Users/aureliengerits/PhpstormProjects/magixcms3/skin/default/css --glob /Users/aureliengerits/PhpstormProjects/magixcms3/skin/default/css/src/less/home.less home.css
SyntaxError: require() of ES Module /Users/aureliengerits/.npm-global/lib/node_modules/globby/index.js from /Users/aureliengerits/.npm-global/lib/node_modules/lessc/node_modules/less/lib/less-node/plugin-loader.js not supported.
Instead change the require of index.js in /Users/aureliengerits/.npm-global/lib/node_modules/lessc/node_modules/less/lib/less-node/plugin-loader.js to a dynamic import() which is available in all CommonJS modules. in /Users/aureliengerits/.npm-global/lib/node_modules/less-plugin-glob/index.js on line 1, column 15:
Best Regards
Aurelien
Please sign in to leave a comment.
Hello!
I'm not sure how this can be fixed on the IDE end... The recent version of a
globby
package is a ESM module (see https://github.com/sindresorhus/globby/blob/main/package.json - it has"type": "module"
) so it can't be imported withrequire()
. See also https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c. Andlessc/node_modules/less/lib/less-node/plugin-loader.js
tries to load it withrequire()
, as far as I can check from the traceBest regards,
Lena