我安装了nodejs并使用
npm install -g generator-jhipster
然后使用jhipster创建项目,但它给了我这样的错误。
INFO! Using bundled JHipster
node:internal/modules/cjs/loader:575
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/util/namespace' is not defined by "exports" in C:\Users\Admin\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-environment\package.json
at new NodeError (node:internal/errors:399:5)
at exportsNotFound (node:internal/modules/esm/resolve:267:10)
at packageExportsResolve (node:internal/modules/esm/resolve:603:9)
at resolveExports (node:internal/modules/cjs/loader:569:36)
at Module._findPath (node:internal/modules/cjs/loader:643:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1068:27)
at Module._load (node:internal/modules/cjs/loader:928:27)
at Module.require (node:internal/modules/cjs/loader:1149:19)
at require (node:internal/modules/helpers:121:18)
at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\generator-jhipster\utils\blueprint.js:19:25)
at Module._compile (node:internal/modules/cjs/loader:1267:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
at Module.load (node:internal/modules/cjs/loader:1125:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at Module.require (node:internal/modules/cjs/loader:1149:19)
at require (node:internal/modules/helpers:121:18) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Node.js v20.0.0
我的nodejs版本是v20。0.0
我尝试安装jhipster,删除node_modules和forge,但没有任何效果,我该如何修复它?
1条答案
按热度按时间qojgxg4l1#
根据这个答案,您应该将
"./lib/util/namespace": "./lib/util/namespace.js"
这一行添加到这个文件中的"exports":
:C:\Users\Admin\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\yeoman-environment\package.json
然后你可以再试一次。