Sunday, 9 October 2016

Node: Installation and Upgrade

Node is installed using nvm and nodejs packages are install using npm.

Initial Installation

1.  Install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
2. Install node version 4
nvm install 4

Upgrade NVM and Node version

1. Upgrade nvm using
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
 
creationix/nvm/v0.32.0/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10007  100 10007    0     0   5040      0  0:00:01  0:00:01 --:--:--  5038
=> nvm is already installed in /Users/Seet/.nvm, trying to update using git
=> 
=> Source string already in /Users/Seet/.bash_profile
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="/Users/Seet/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

2. Upgrade to stable node js 5 version
nvm install 5
######################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v5.12.0 (npm v3.8.6)
3. Uninstall node js 4
nvm uninstall 4
4. Set nvm alias to avoid this error: "N/A: version "N/A" is not yet installed."
nvm alias default v5.12.0
5. Useful command for debugging
> nvm alias
default -> v5.12.0
node -> stable (-> v5.12.0) (default)
stable -> 5.12 (-> v5.12.0) (default)
iojs -> N/A (default)
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.6.0 (-> N/A)
> nvm debug
nvm --version: v0.32.0
$SHELL: /bin/bash
$HOME: /Users/Nebitrams
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: v5.12.0
which node: $NVM_DIR/versions/node/v5.12.0/bin/node
which iojs:
which npm: $NVM_DIR/versions/node/v5.12.0/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v5.12.0
npm root -g: $NVM_DIR/versions/node/v5.12.0/lib/node_modules

Upgrade NPM

1. Upgrade nvm using
npm install -g npm@latest

Common Issue for Parse-server Upgrade

This is a common error during upgrade of parse-server.  After upgrade, the npm start may ends with error like this: "Cannot find module 'double-ended-queue'".

If you run npm list, you will see some missing modules such as the followings:
npm ERR! missing: double-ended-queue@^2.1.0-0, required by redis@2.8.0
npm ERR! missing: redis-commands@^1.2.0, required by redis@2.8.0
npm ERR! missing: redis-parser@^2.6.0, required by redis@2.8.0
 You can try to delete the package-lock.json and node_modules folder, following by re-install.

rm -rf package-lock.json node_modules/
npm i --no-optional
npm dedupe
npm up
Refer to https://github.com/npm/npm/issues/19393 for more information.

No comments:

Post a comment