JHipster Version 7.9.3使用本地蓝图导致npm ERR!404未找到



我使用JFrog来管理我的npm存储库,并且已经创建了一个虚拟目录,其中存在蓝图(作为本地目录的一部分)。我在我的~/.npmrc中有以下内容:

//jaiashirwaad.jfrog.io/artifactory/api/npm/default-npm-virtual/:_auth = asdfaasdfasdf23e234wadefasdfasdfasdfasd
email = info@mycompany.com
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  'generator-jhipster-saathratri-cassandra-blueprint@7.9.3' 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  'generator-jhipster-saathratri-cassandra-blueprint@7.9.3' 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
}

请建议。

我解决了这个问题。我注意到包裹里有以下内容。my services的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. js在我的蓝图。

我决定搜索"package.json"这个词。和";package.json.ejs"在generator-jhipster目录中找到:在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。

所以我想,从上面的结果来看,有一种方法可以不把我的本地蓝图输出到服务包中。

所以我试着把我运行的命令改为:jhipster --blueprints saathratri-cassandra-blueprint jdl --skip-fake-data --skip-jhipster-dependencies apps.jh,这就成功了。No more 404 error.

最新更新