简体   繁体   中英

“npm install <github url>” Downloading from NPM instead of GitHub

So I am trying to install a package from GitHub, but for some reason npm install is pulling a different package (which has the same name) from NPM, instead of GitHub.

When I run npm install git+https://github.com/wojtekmaj/react-daterange-picker , it for some reason installs the package https://github.com/onefinestay/react-daterange-picker . This happens even if I manually insert the GitHub package url into my package.json dependancies, and then run npm install .

I have even tried deleting all my cache, and even deleting /node_modules/ and package-lock.json and reinstalling via the command rm -rf node_modules package-lock.json && npm install .

Any ideas why npm install is pulling from NPM instead of GitHub?

If I understand you correctly you do rm -rf node_modules package-lock.json && npm install before trying your command. But this will install everything according to package.json and recreate package-lock.json . So when you do your modified command it won't work.

I think the best way is to:

  1. rm -rf package-lock.json node_modules
  2. Modify your package.json to use the correct git+https link
  3. npm install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM