我使用 JFrog 来管理我的 npm 存储库,并且已经创建了一个虚拟目录,其中存在蓝图(作为本地目录的一部分)。我的 ~/.npmrc 中有以下内容:
//jaiashirwaad.jfrog.io/artifactory/api/npm/default-npm-virtual/:_auth = asdfaasdfasdf23e234wadefasdfasdfasdfasd
email = [email protected]
always-auth = true
运行命令时我得到以下信息:
jhipster --blueprints saathratri-cassandra-blueprint jdl --skip-fake-data apps.jh
:
INFO! Generator app child process exited with code 1idealTree:node_modules/string-width/node_modules/strip-ansi Completed in 1ms
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/generator-jhipster-saathratri-cassandra-blueprint - Not found
npm ERR! 404
npm ERR! 404 '[email protected]' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/amar/.npm/_logs/2023-01-20T22_36_39_488Z-debug-0.log
ERROR! Command failed with exit code 1: npm install
Error: Command failed with exit code 1: npm install
at makeError (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/node_modules/execa/lib/error.js:60:11)
at handlePromise (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/node_modules/execa/index.js:118:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
shortMessage: 'Command failed with exit code 1: npm install',
command: 'npm install',
escapedCommand: 'npm install',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/generator-jhipster-saathratri-cassandra-blueprint - Not found
npm ERR! 404
npm ERR! 404 '[email protected]' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/amar/.npm/_logs/2023-01-20T22_36_55_013Z-debug-0.log
ERROR! Command failed with exit code 1: npm install
INFO! Generator app child process exited with code 1
Error: Command failed with exit code 1: npm install
at makeError (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/node_modules/execa/lib/error.js:60:11)
at handlePromise (/usr/local/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/node_modules/execa/index.js:118:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
shortMessage: 'Command failed with exit code 1: npm install',
command: 'npm install',
escapedCommand: 'npm install',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
请指教
我解决了这个问题。我在我的服务的 package.json 文件中注意到以下内容:
"devDependencies": {
"generator-jhipster": "7.6.0",
"generator-jhipster-saathratri-cassandra-blueprint": "7.6.0",
"prettier": "2.5.1",
"prettier-plugin-java": "1.6.1",
"prettier-plugin-packagejson": "2.2.15"
},
也许我可以换线
"generator-jhipster-saathratri-cassandra-blueprint": "7.6.0",
到
"generator-jhipster-saathratri-cassandra-blueprint": "file:../relative/path/to/generator-jhipster-saathratri-cassandra-blueprint",
错误会消失,但我不想这样做,因为这会涉及到我自己在我的蓝图中注入我的 package.json.ejs 版本。
我决定在generator-jhipster目录下搜索“package.json”和“package.json.ejs”这两个词,发现: 在 options.js 中:
'skip-jhipster-dependencies': {
desc: "Don't add generator-jhipster and blueprints to package.json.",
type: Boolean,
},
然后搜索skipJhipsterDependencies,发现:
<%_ if (!skipJhipsterDependencies) { _%>
"generator-jhipster": "<%= packagejs.version %>",
<%_ otherModules.forEach(module => { _%>
"<%= module.name %>": "<%= module.version %>",
<%_ }); _%>
<%_ } _%>
在 package.json.ejs.
所以我想,从上面的结果来看,有一种方法可以在 services package.json 的 devDependencies 部分中不输出我的本地蓝图。
所以我尝试将我运行的命令更改为:
jhipster --blueprints saathratri-cassandra-blueprint jdl --skip-fake-data --skip-jhipster-dependencies apps.jh
并且成功了。没有更多的 404 错误。