Table of Contents
Linux install
1. Install nodejs globally in user's folder
Install global npm:
dnf install nodejs zypper in nodejs10
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global' cat ~/.npmrc prefix=~/.npm-global
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile
Starting Development
2. New project
Navigate to the directory in which you want your project to exist – in my case, sites/node-test.
cd sites/node-test
Now initalize a new project with npm.
npm init
The following will pop up in the terminal, and prompt you for a few
This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sensible defaults. See `npm help json` for definitive documentation on these fields and exactly what they do. Use `npm install ` afterwards to install a package and save it as a dependency in the package.json file.
3. Installing packages
npm install dependency-name-here
add –save, –save-dev. The dependency will be written to package.json
Install all deps
npm install