npm install not considering registry/resolved path in package-lock.json - npm

It's pretty straight forward to install a package from a private registry:
npm install my-package --registry https://<private-registry-url>
This will add an entry to the package-lock.json:
"my-package": {
"version": "1.0.0",
"resolved": "https://<private-registry-url>/<some_path>/my-package-1.0.0.tgz",
"integrity": "sha1-Pjs/y9sEp49/OC8+8eEZFdwT3BQ="
},
So far so good, everything as expected.
The problem now is when you want to install all npm packages from a different device using npm install. This will fail with following error:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/my-package - Not found
npm ERR! 404
npm ERR! 404 'my-package#1.0.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'app'
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! C:\Users\<user>\AppData\Roaming\npm-cache\_logs\2019-08-06T08_33_05_103Z-debug.log
So it tries to fetch my-package from the public npm registry (https://registry.npmjs.org/my-package), but of course fails because my-package is located in the private registry.
Now this really breaks my understanding of package-lock.json..
Shouldn't npm look in the package-lock.json to see where the packages were resolved before? Instead it just assumes that it has to be in the public registry..
The other funny thing is, that it works once you manually installed the package with the --registry flag again:
npm install my-package --registry https://<private-registry-url> && npm i
And after that it will work everytime until you upgrade the version of my-package or switch the device..
I also tried npm ci command but without success (same error).
So how to properly install packages from private registries, so they can easily be installed on any other device using npm install?

Related

trying to run npm install epexcharts react-apexcharts command

I'm trying to run a npm install epexcharts react-apexcharts command, and get an error that looks like this :
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/epexcharts - Not found
npm ERR! 404
npm ERR! 404 'epexcharts#*' 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! /var/root/.npm/_logs/2023-02-15T00_48_54_690Z-debug-0.log
I tried to reinstall npm, but seems like the issue remains the same
The error you have is basically telling you that the package which you are looking for does not exist in the npm registry and you can check that yourself here: https://www.npmjs.com/search?q=epexcharts
Or you can simply run the npm command to check if this library exists or not before installing it: npm search epexcharts.
But I think you are writing actually the false command which instead you should write: npm install react-apexcharts.

Can't install packages using "npm install"

I am new to React native, javascript.
I am trying to install packages using npm install.
But I can't install anything. All the time I get the same error:
npm install #tensorflow/tfjs
npm ERR! 404 Object Not Found - GET https://skimdb.npmjs.com/registry/form-data/-/form-data-
3.0.1.tgz - not_found
npm ERR! 404
npm ERR! 404 'form-data#https://skimdb.npmjs.com/registry/form-data/-/form-data-3.0.1.tgz' is
not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Try this setting :
npm config set registry http://registry.npmjs.org
Yeah so depending on your correlative, there might be somethings wrong with your node in general,
you could try using
yarn
yarn add #tensorflow/tfjs

Can't install here-api-for-javascript from package.json

I add package as described in docs in second point:
$ npm install #here/maps-api-for-javascript --save
After that I get in package.json:
//...
"dependencies": {
"#here/maps-api-for-javascript": "^1.17.2"
}
//...
After some changes I deploy code to remote server and type:
$ npm install
and get error:
/...
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#here%2fmaps-api-for-javascript - Not found
npm ERR! 404
npm ERR! 404 '#here/maps-api-for-javascript#1.17.2' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
I'm using yarn (v3.2.4):
In this case, you must add the next code to your .yarnrc.yml
nodeLinker: node-modules
npmScopes:
here:
npmPublishRegistry: "https://repo.platform.here.com/artifactory/api/npm/maps-api-for-javascript/"
npmRegistryServer: "https://repo.platform.here.com/artifactory/api/npm/maps-api-for-javascript/"
After, you can do Yarn install.

Can't install expo-cli to use react-native

I'm new in react-native and tried to install expo-cli in windows 10 following the page of react-native, id used the command npm init expo-cli and I have that error:
npm ERR! code E404
npm ERR! 404
npm ERR! 404 'create-expo-cli#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
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! C:\Users\Miguelangel\AppData\Roaming\npm-cache\_logs\2020-06-24T11_01_08_933Z-debug.log
Install for [ 'create-expo-cli#latest' ] failed with code 1
There is no create-expo-cli package. It's just expo-cli.
npm install -g expo-cli

npm - 404 Not Found - GET http://registry.npmjs.org/https-proxy-agent-snyk-fork

Running a period npm update I received this error:
npm ERR! code E404
npm ERR! 404 Not Found - GET http://registry.npmjs.org/https-proxy-agent-snyk-fork - Not found
npm ERR! 404 'https-proxy-agent-snyk-fork#*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'proxy-agent'
I already tried to change the registry path to both http://registry.npmjs.org/ and https://registry.npmjs.org/ with and without final "/" and to set strict-ssl to false, but nothing changes.
Once I got similar error, and what worked for me was this (I hope also to you):
npm config set registry http://registry.npmjs.org
npm -g install npm
npm cache clean -f
and try again to run period npm update as you did before.