1.0.1 • Published 10 years ago
@alabebop/how-to-npm v1.0.1
Learn to npm!
This repository contains my learning notes of the NodeSchool workshop "How to npm"
If you get a .lock error trying to install a package, it may be caused by your previous installing packages in your home folder with
sudo
, i.e. asroot
. The fix is to change the owner of the.npm
folder back to yourself instead ofroot
with commandchown
``` $ sudo chown -R my.user ~/.npm ```
If you install packages locally without first having them declared as dependencies in the
package.json
file, you are able to install them but will get anextraneous
error, which indicates that the package is extraneous to the project.* To remove an extraneous package, use the npm command `prune` ``` $ npm prune <name> ``` * To install a package as well as having it declared as a dependency in your `package.json` file at the same time, use the `--save` parameter when installing, or the `--save-dev` parameter to have it declared as a devDependency ``` $ npm install <package> --save ``` ``` $ npm install <package> --save-dev ```