1

I have just read tutorial on Angularjs and wanted to run test application (by (C) Wahlin Consulting) from http://tinyurl.com/AngularJSDemos . Its readme informs that:

NODE.JS OPTION:

If you want to run the site using Node.js (install it from http://nodejs.org) run the following at the command-prompt from within the AngularJSDemos folder:

node server.js

Now navigate to http://localhost:8080/DemoList.html or     http://localhost:8080/CustomerManagementApp in your browser.

I have installed nodejs and tried to launch it from terminal in my Ubuntu system:

mainuser@mylaptop:~$ cd /home/mainuser/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos/
mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ node server.js
The program 'node' can be found in the following packages:
 * node
 * nodejs-legacy
Try: sudo apt-get install <selected package>
mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ sudo apt-get install node

...

mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ node server.js
mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ node server.js
mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ node
mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ node ./server.js &
[1] 11153
mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ node ./server.js
[1]+  Exit 1                  node ./server.js
mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ node ./server.js
mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version.
The following packages were automatically installed and are no longer required:
  kde-l10n-engb kde-l10n-pl linux-headers-3.13.0-32
  linux-headers-3.13.0-32-generic
Use 'apt-get autoremove' to remove them.
0 to upgrade, 0 to newly install, 0 to remove and 28 not to upgrade.
mainuser@mylaptop:~/Ebooks/AngularJS/AngularJSDemos/AngularJSDemos$ 

But whatever I do, I cannot launch this example. In Chrome "This web page is not available" and in Firefox "Unable to connect". Moreover, it looks like I simply cannot launch it in terminal.

How to launch this example?

4 Answers 4

1

I'd recommend using nvm to install node and manage different version on your system.

It's quite easy:

# First, we need to clone the nvm repository:
$ git clone https://github.com/creationix/nvm.git ~/.nvm

# Then, we need to add the following line to our .profile, .bashrc or .zshrc:
$ echo "source ~/.nvm/nvm.sh" >> .zshrc

Installing nvm is not enough, we now need to install node & npm.

# To print out the list of all the available versions, simply run:
$ nvm ls-remote

# We want to install the current stable version which is v0.10.26, so we need to run:
The -s flag means we want to compile node from source.
$ nvm install -s v0.10.30

When the installation process is finished, our brand new node and npm will be installed! The great thing with nvm is that you can use a different version of node in each of your shell instances. But if you want to stick to the latest version, you can set it as default by running:

$ nvm alias default 0.10.30

Make sure everything is up and running by typing node -v && npm -v

Sign up to request clarification or add additional context in comments.

Comments

1

Here's a different approach for this problem, the tutorial is suggesting using npm and it's fine. but it takes time, an internet connection and setting up. Here's an alternative way, if you're already using Ubuntu, python should already be installed in your system. your python installation already comes with a simple HTTP server you can use to run your angular application.

in your console, type python -m SimpleHTTPServer 8080

then direct your browser to localhost:8080

and locate your angular project. then it should run properly.

Comments

0

You probably installed incorrect node package.

Thanks to that your node command is not equal to nodejs but invokes something totally different.

Try with

nodejs ./server.js

Comments

0

Install node in ubuntu using

sudo-apt-get install nodejs
sudo apt-get install npm
sudo apt-get install build-essential

and then run your server with following command

npm start

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.