Skip to content

Instantly share code, notes, and snippets.

@iJKTen
Created March 15, 2020 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iJKTen/8b178a3f447f2fce88151c542396a777 to your computer and use it in GitHub Desktop.
Save iJKTen/8b178a3f447f2fce88151c542396a777 to your computer and use it in GitHub Desktop.
To create a new project with prompts
> npm init
To create a new project without prompts
> npm init -y
Install a package (will be used in production)
> npm install <package-name>
Installing a dev package
> npm install —save-dev nodemon
> npm i —D nodemon
Run npm script
In package.json under scripts, create a new dev entry to run nodemon <filename>
Command to run that script
> npm run dev
List outdated packages in your app
> npm outdated
List outdated globally
> npm outdated -g
Update package globally
> npm install <package-name>@latest -g
Uninstall package
> npm uninstall <package-name>
Uninstall packages globally
> npm uninstall -g <package-name>
Environment Variables
Access environment variables
> process.env.NODE_ENV
Environment variable to set node environment
> NODE_ENV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment