During your initial build command, most commonly when running
npm install, you might run an error similar to the following:
npm ERR! notarget No matching version found for @firstname.lastname@example.org
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@package/dependency/-/dependency-0.1.0.tgz
This might happen if you have a dependency that is being installed as a result of one of the packages in your
package.json file, but the version it is looking for doesn't exist in the versions list in the NPM registry. Or, the package may have been simply removed.
- But why does it work locally when I run npm install?
You might indeed find that this works locally when you run the same commands - the first thing to check if that's the case is that your
package-lock.json file is committed to your repository so that when DeployHQ is running your build commands, it's using exactly the same versions as you do locally.
Just committing package.json without the accompanying lock file may render unexpected results if you are using wildcards, or not specifying certain versions of packages. This would probably cause DeployHQ to try and fetch a newer version than what you're actually already using.
This article provides an excellent overview of how you can specify certain versions of packages in your package.json file.