Skip to content

Instantly share code, notes, and snippets.

@narutaro
Last active December 12, 2015 21:49
Show Gist options
  • Save narutaro/ec4c2ba4ffe081a05e45 to your computer and use it in GitHub Desktop.
Save narutaro/ec4c2ba4ffe081a05e45 to your computer and use it in GitHub Desktop.
node.js installation
sudo apt-get update && apt-get upgrade
sudo apt-get install nodejs
sudo apt-get install npm

##Version

# nodejs -v
v0.10.25

Still 0.xx, really??

##Hello world

# more hw.js 
#!/usr/bin/env nodejs
console.log('hellow world');

##Run

# ./hw.js 
hellow world

##Install a package - JQuery Use package manager npm

# npm list       
/root
└── (empty)

# npm install jquery
npm http GET https://registry.npmjs.org/jquery
npm http 200 https://registry.npmjs.org/jquery
npm http GET https://registry.npmjs.org/jquery/-/jquery-2.1.4.tgz
npm http 200 https://registry.npmjs.org/jquery/-/jquery-2.1.4.tgz
jquery@2.1.4 node_modules/jquery

# npm list
/root
└── jquery@2.1.4

Looks OK.

# ls
hw.js  node_modules  tmp

node_modules and tmp showed up after npm install

In order to use JQuery in node, you need jsdom 3.1.2. The latest jsdom does not work with node js anymore.

npm install -S 'jsdom@3.1.2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment