Node NPM - Tuong-Nguyen/JavaScript-Structure GitHub Wiki
NodeJS
NodeJS platform: Platform for developing applications (console application, web server, ...) with JavaScript.
- Install at https://nodejs.org/en/
NPM
NPM: node package management - Like Maven or Gradle for Java. This tool allows us to add/remove javascript libraries. It is installed along with NodeJS.
package.json: configuration file
Install packages
# install gulp-cli library into the project
npm install gulp-cli
# install gulp-cli library into the system
npm install gulp-cli -g
# install gulp-cli library for dev environment only
npm install gulp-cli --save-dev
Run scripts:
npm can run commands defined in scripts section of package.json
# run a command
npm run [command]
Webstorm
- Enable Node: File > Settings > Languages & Frameworks > Node.js and NPM > Enable
- Set JavaScript version: File > Settings > Languages & Frameworks > JavaScript: JavaScript Language version = ECMAScript 6; Prefer Strict mode
- Add intellisense for libraries: File > Settings > Languages & Frameworks > JavaScript > Libraries: Download - Select the library and download.