Ran into trouble installing NPM packages today. Running
npm install in my working directory where a
package.json exists and includes project dependencies resulted in only a handful of packages getting installed in
node_modules/ and errors when I tried to install the rest one by one.
Ultimately, I needed to update XCode on my computer and install v0.12 of Node instead of the latest released version. Before I realized that was the case, I learned how to manually install NPM packages without using
npm install <somepackage>. I thought it was a useful piece of info to share. Hope it's helpful to you.
Installing NPM Packages Manually
Note: This assumes you have Node installed and npm.
- Go to the package's repo on Github.com
- Copy the HTTPS clone URL to your clipboard
cd /usr/local/lib/node_modules(where NPM puts packages you install globally).
git clone <clone URL>
cdinto the package directory
Example installing nodemon:
1. Go to https://github.com/remy/nodemon
2. Copy HTTPS clone URL
git clone email@example.com:remy/nodemon.git