Обзор проблемы После установки jhipster с помощью npm, когда я пытаюсь выполнить любую команду jhipster, я получаю следующую ошибку:
Мотивация или сценарий использования Команды JHipster не выполняются
Воспроизведите ошибку - Установите jhipster, используя npm как в документах
npm install -g generator-jhipster
- run
jhipster
или jhipster info
internal/modules/cjs/loader.js:1172
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\...\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\is-promise\index.js
require() of ES modules is not supported.
require() of C:\Users\...\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\is-promise\index.js from C:\Users\...\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\run-async\index.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 C:\Users\...\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\is-promise\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\...\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\is-promise\package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1172:13)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\...\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\run-async\index.js:3:17)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14) {
code: 'ERR_REQUIRE_ESM'
}
Версии npm 6.14.4
node v12.16.2
OS: win10
generator-jhipster@6.8.0
https://github.com/jhipster/generator-jhipster/issues/11638