Is it possible to install package from git reposit

2020-03-05 23:18发布

问题:

I've downloaded manually master branch of repository via Download ZIP button on GitHub. Now, my question is:

Is it possible to install package from git repository from downloaded .zip file in npm?

Running:

$ npm install ~/Pobrane/lwip-master.zip

Failed:

npm ERR! not a package /home/name/Pobrane/lwip-master.zip
npm ERR! addLocal Could not install /home/name/Pobrane/lwip-master.zip
npm ERR! Linux 4.2.0-11-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "/home/name/Pobrane/lwip-master.zip"
npm ERR! node v4.0.0
npm ERR! npm  v3.3.4
npm ERR! path /tmp/npm-4968-42fe38a2/unpack-56722f88bedcd792268b060f241bf5f9/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/tmp/npm-4968-42fe38a2/unpack-56722f88bedcd792268b060f241bf5f9/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /home/name/Projects/api/npm-debug.log

回答1:

Try this :

npm install ./package.zip

Reference: https://docs.npmjs.com/cli/install



回答2:

It doesnot work with the github zip download unless you unzip the package with his name as the main directory and request the installation with npm on this root directory

Example

download material-design-icons from github
unzip to the directory of your project (or c:\tmp) 
npm install  ./material-design-icons

or npm install c:/tmp/material-design-icons

It work nicely and fast!



标签: npm