Search code examples
jhipsterjhipster-blueprint

JHipster Version 7.9.3 Using Local Blueprint Gives npm ERR! 404 Not Found


I use JFrog to manage my npm repository and have already created a virtual directory in which the blueprint exists (as part of the local directory). I have the following in my ~/.npmrc:

//jaiashirwaad.jfrog.io/artifactory/api/npm/default-npm-virtual/:_auth = asdfaasdfasdf23e234wadefasdfasdfasdfasd
email = [email protected]
always-auth = true

I get the following when running the command: 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
}

Please advise.


Solution

  • I solved this issue. I noticed the following in the package.json files of my services:

      "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"
      },
    

    Perhaps I could have changed the line

     "generator-jhipster-saathratri-cassandra-blueprint": "7.6.0",
    

    to

      "generator-jhipster-saathratri-cassandra-blueprint": "file:../relative/path/to/generator-jhipster-saathratri-cassandra-blueprint",
    

    and the error would go away but I did not want to since it would involve me injecting my version of package.json.ejs myself in my blueprint.

    I decided to search for the word "package.json" and "package.json.ejs" in the generator-jhipster directory and found: In options.js:

      'skip-jhipster-dependencies': {
        desc: "Don't add generator-jhipster and blueprints to package.json.",
        type: Boolean,
      },
    

    and then search for skipJhipsterDependencies and found:

    <%_ if (!skipJhipsterDependencies) { _%>
        "generator-jhipster": "<%= packagejs.version %>",
      <%_ otherModules.forEach(module => { _%>
        "<%= module.name %>": "<%= module.version %>",
      <%_ }); _%>
    <%_ } _%>
    

    in package.json.ejs.

    So I figured, from the above results, there was a way of not outputting my local blueprint in the services package.json's devDependencies section.

    So I tried changing the command I run to: jhipster --blueprints saathratri-cassandra-blueprint jdl --skip-fake-data --skip-jhipster-dependencies apps.jh and that did the trick. No more 404 error.