NodeJS

Package manager:

Manage node version using n

npm install -g n # setup

n 0.10.33  # install/use v0.10.33
n latest # install/use the latest version
n stable # install/use the latest stable version

Downgrade the npm (make sure your node is compatable with npm)

npm install -g npm@3.10.10

Update the npm

npm install npm@latest -g

Another alternative is using NVM –> never tried

setting up a minimal node with webpack and babel

https://github.com/facebook/create-react-app

Where does npm install package?

og: https://stackoverflow.com/questions/5926672/where-does-npm-install-packages/5926706#5926706

npm list -g # global library
npm list # local library

npm root -g
npm rooot

# global library possiblity
cd /usr/local/lib/node
cd /usr/local/lib/node_modules
cd $NODE_PATH
cd %USERPROFILE%\AppData\npm\node_modules # windows XP
cd %USERPROFILE%\AppData\Roaming\npm\node_modules # windows 7/8/10


# local library
cd node_modules

Production Process Manager

Error: Maximum call stack size exceeded

Try one of below:

  1. Remove package-lock.json
  2. Clear cache npm cache clean --force
  3. NPM Rebuild npm rebuild

Code snippet

Read file line by line

var lineReader = require('readline').createInterface({
  input: require('fs').createReadStream('file.in')
});

lineReader.on('line', function (line) {
  console.log('Line from file:', line);
});