Here is examples for X1 js lectures.
You need to install node.js on your environment:
- Install nvm (Node Version Manager) this thing allows you to have multiple node.js versions at a time and switch between them from project to project
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
- Install node.js using nvm
$ nvm install 5.6.0
- Make version node.js 5.6.0 default (not necessary)
$ nvm alias default 5.6.0
- Go to examples folder and install all dependencies with npm (node package manager) that installed with node.js
$ npm install
- Run web server using gulp plugin
$ gulp serve
- Download the Windows installer from the Nodes.js web site.
- Run the installer (the .msi file you downloaded in the previous step.)
- Follow the prompts in the installer (Accept the license agreement, click the NEXT button a bunch of times and accept the default installation settings).
- Restart your computer. You won’t be able to run Node.js® until you restart your computer.
Make sure you have Node and NPM installed by running simple commands to see what version of each is installed and to run a simple test program:
- Test Node. To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type
node -v
. This should print a version number, so you’ll see something like thisv0.10.35
. - Test NPM. To see if NPM is installed, type
npm -v
in Terminal. This should print NPM’s version number so you’ll see something like this1.4.28
- Create a test file and run it. A simple way to test that node.js works is to create a JavaScript file: name it
hello.js
, and just add the codeconsole.log('Node is installed!');
. To run the code simply open your command line program, navigate to the folder where you save the file and type nodehello.js
. This will start Node and run the code in thehello.js
file. You should see the outputNode is installed!
.
- Download a pre-compiled binary package from the Nodejs.org site.
- Install the sowtware by following along the install wizard.
At the end of the install you are prompted to make sure that /usr/local/bin
is in your path, double check you have it by running in the Terminal echo $PATH
.
If not add it in either .bash_profile
or .bashrc
in your home directory.
- Test Node. To see if Node is installed, open the Terminal and type
node -v
. This should print a version number, so you’ll see something like thisv0.10.35
. - Test NPM. To see if NPM is installed, type
npm -v
in Terminal. This should print NPM’s version number so you’ll see something like this1.4.28
- Install XCode. Apple’s XCode development software is used to build Mac and iOS apps, but it also includes the tools you need to compile software for use on your Mac. XCode is free and you can find it in the Apple App Store.
- Install Homebrew. Homebrew is a package manager for the Mac — it makes installing most open source sofware (like Node) quite simple. You can learn more about Homebrew at the Homebrew website. To install Homebrew just open Terminal and type
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
. You’ll see messages in the Terminal explaining what you need to do to complete the installation process. - Open the Terminal app and type
brew install node
- Wait, Homebrew downloads some files and installs them.
Make sure you have Node and NPM installed by running simple commands to see what version of each is installed and to run a simple test program:
- Test Node. To see if Node is installed, open the Terminal and type
node -v
. This should print a version number, so you’ll see something like thisv0.10.35
. - Test NPM. To see if NPM is installed, type
npm -v
in Terminal. This should print NPM’s version number so you’ll see something like this1.4.28