gulp-image icon indicating copy to clipboard operation
gulp-image copied to clipboard

Don't work - Error [ERR_REQUIRE_ESM]: Must use import to load ES Module

Open my-user-git opened this issue 2 years ago • 5 comments

$ gulp Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ...\06_test_Gulp\node_modules\gulp-image\index.js require() of ES modules is not supported. require() of ...\06_test_Gulp\node_modules\gulp-image\index.js from ...\06_test_Gulp\gulpfile.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from ...\06_test_Gulp\node_modules\gulp-image\package.json.

at new NodeError (node:internal/errors:363:5)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1126:13)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (...\06_test_Gulp\gulpfile.js:7:15)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32) {

code: 'ERR_REQUIRE_ESM' }

my-user-git avatar Dec 13 '21 12:12 my-user-git

Same here. I was able to downgrade to 6.2.1 and get it running.

jbsmith731 avatar Dec 15 '21 20:12 jbsmith731

Thank you very much! Downgraded the version now the error does not appear, I check whether the plugin works

my-user-git avatar Dec 16 '21 11:12 my-user-git

Duplicate of #139

jbsmith731 avatar Jan 17 '22 17:01 jbsmith731

@elcaptain I believe it should be npm install [email protected].

jbsmith731 avatar Jan 25 '22 15:01 jbsmith731

@jbsmith731 yes, thanks. I noticed it myself shortly after so i deleted my original post, sorry ^^" I can report that downgrading solved my error too.

elcaptain avatar Jan 25 '22 16:01 elcaptain