Node Commands

# How install specific node version on Ubuntu
https://github.com/nodesource/distributions/blob/master/README.md

 npm commands:

  •  npm init - To initalize the package. This will create package.json on the fly
  •  npm install - This will look for package.json and install all the listed packages
  • npm insall -g <package name> - To install packages globally
  • npm install --save <package name> - To install packages locally, as well as add entry to package.json file
  • npm install --save-dev <package name> - To install packages locally, as well as add entry to dev section in the package.json
  • npm list -g --depth=0 - To list all the globally installed packages. Without depth, will list down all the installed packages and sub packages
  • npm view cordova versions - List down all the released versions
  •  npm uninstall --save <package name> - To  remove packages from locally. --save will remove entry from package.json
  • npm cache clean - Delete data out of the cache folder. If an argument is provided, then it specifies a subpath to delete. If no argument is provided, then the entire cache is cleared.
  • npm run <script name> - To run npm services which are attached via package.json scripts section.
    eg: https://github.com/dilumdarshana/OOPJavascript/blob/master/package.json
    npm run dev - This will run the command inside it 'light-server'
Notes:
  • Package name in package.json should not be same as node module name which are going to use in the project
  • https://www.npmjs.com/ where can search all the available node modules
  • npm global installations will keep in '/usr/local/lib/node_modules' in Mac

Architecture Related

- node -p 'process.version.v8' - Check V8 version being used
- node --v8-options | grep "in progress" - To check In Progress features
Note: Can check in progress feature with --harmony flag
Eg. node --harmony -p 'function test(a, b,) {}'


Comments

Popular posts from this blog

Kubernetes for Micro Services

Laravel 5.3

Node-RED