Node Package Manager (NPM) Handy Commands

Posting some notes on using NPM and commands that I have found necessary to use:
Create package.json
npm init

  • make sure that name of app is URL friendly EX: nodejs-test-app

Installing Node Package and saving to dependency
npm install moment --save

  • saves it under as app dependency -needed to run app

Installing Node Dev Package and saving to dev dependency
npm install jasmine-node --save-dev

  • allows you to save a dev tool dependency

If you need to fix global install permissions
https://docs.npmjs.com/getting-started/fixing-npm-permissions
Installing a Global Package
npm install -g nodemon

Update All Packages in an App
npm update

Download the required files for an app
npm install

Duncan Leung

Front End Developer at iHerb.com

Irvine, CA

Subscribe to Duncan Leung: Javascript and Front End Development

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!