You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

JHipster 7.9.3使用本地蓝图时出现npm ERR! 404 Not Found求助

问题背景

使用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

时触发错误,核心问题是npm默认从https://registry.npmjs.org查找私有蓝图包导致404,完整错误日志如下:

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
}
解决方案建议
  • 修正.npmrc的registry配置:当前配置仅设置了JFrog仓库的认证信息,但未指定npm默认使用该仓库。需添加registry字段指向JFrog虚拟仓库,修改后的~/.npmrc如下:
    registry=https://jaiashirwaad.jfrog.io/artifactory/api/npm/default-npm-virtual/
    //jaiashirwaad.jfrog.io/artifactory/api/npm/default-npm-virtual/:_auth = asdfaasdfasdf23e234wadefasdfasdfasdfasd
    email = info@mycompany.com
    always-auth = true
    
  • 验证JFrog虚拟仓库配置:确认default-npm-virtual虚拟仓库已将存放蓝图包的本地仓库添加为成员,且generator-jhipster-saathratri-cassandra-blueprint@7.9.3已成功上传至本地仓库。
  • 手动指定仓库安装蓝图:若不想全局修改npm配置,可先手动指定JFrog仓库安装蓝图包,再执行JHipster命令:
    npm install generator-jhipster-saathratri-cassandra-blueprint@7.9.3 --registry=https://jaiashirwaad.jfrog.io/artifactory/api/npm/default-npm-virtual/
    jhipster --blueprints saathratri-cassandra-blueprint jdl --skip-fake-data apps.jh
    
  • 检查仓库权限:确认.npmrc中的_auth令牌拥有访问JFrog虚拟仓库及对应本地包的权限,避免因权限不足导致404错误。

内容的提问来源于stack exchange,提问作者Amar Premsaran Patel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 22:30:49