1

I am getting weird error 8 with below output while doing $ npm start

SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! not ok code 0

npm -v 1.3.10

node -v v0.10.25

I have installed nodejs-legacy

$ which node
/usr/bin/node

$ which nodejs
/usr/bin/nodejs

Can somebody please help with it.

I am trying to run react-jsonschema-form or word-finder (https://github.com/amirrajan/word-finder) on ubuntu 14.04

  • I am getting the below error now: **vagrant@oyin:~/word-finder-master$ npm install npm ERR! registry error parsing json npm ERR! registry error parsing json npm ERR! registry error parsing json npm ERR! registry error parsing json npm ERR! registry error parsing json npm ERR! registry error parsing json npm ERR! registry error parsing json npm ERR! registry error parsing json npm ERR! Linux 3.19.0-25-generic npm ERR! argv "/opt/node-v6.6.0/bin/node" "/opt/node/bin/npm" "install" npm ERR! node v6.6.0 npm ERR! npm v3.10.3** Please can somebody help me with this – Oyindrila Bhattacharjee Sep 26 '16 at 13:04

1 Answers1

1

You are using Node 0.10 - currently the LTS version is 4.5.0 and the Current version is 6.6.0. Consider upgrading Node because you are using a very outdated version. Node 0.10 was released on March 2013, its maintainence period ends in a week (on October 1, 2016) and then it will no longer get any updates, see: https://github.com/nodejs/LTS#lts_schedule

According to package.json in github.com/mozilla-services/react-jsonschema-form the required Node version is at least 6.x and npm 2.14.7. You are trying to run it on Node v0.10.25 and npm 1.3.10. You shouldn't expect it to work.

To install a modern version of Node, you can either download a binary version from https://nodejs.org/ or you can build it from source, for example with a procedure similar to this one:

If you want to have node installed in /usr/local and available as /usr/local/bin/node you can do this:

# change dir to your home:
cd ~
# download the source:
curl -O https://nodejs.org/dist/v6.6.0/node-v6.6.0.tar.gz
# extract the archive:
tar xzvf node-v6.6.0.tar.gz
# go into the extracted dir:
cd node-v6.6.0
# configure for installation:
./configure --prefix=/usr/local
# build and test:
make && make test
# install:
sudo make install
# make sure you have /usr/local/bin in your $PATH before /usr/bin:
# add this to your .profile or .bashrc:
PATH="/usr/local/bin:$PATH"

Or if you want to be able to have few versions installed at the same time, with a symlink to the default one to use:

# change dir to your home:
cd ~
# download the source:
curl -O https://nodejs.org/dist/v6.6.0/node-v6.6.0.tar.gz
# extract the archive:
tar xzvf node-v6.6.0.tar.gz
# go into the extracted dir:
cd node-v6.6.0
# configure for installation:
./configure --prefix=/opt/node-v6.6.0
# build and test:
make && make test
# install:
sudo make install
# make a symlink to that version:
sudo ln -svf /opt/node-v6.6.0 /opt/node
# make sure you have /opt/node/bin in your $PATH before /usr/bin
# add this to your .profile or .bashrc:
PATH="/opt/node/bin:$PATH"

See this answer for more info.

Community
  • 1
  • 1
rsp
  • 107,747
  • 29
  • 201
  • 177
  • Thanks @rsp I have upgraded npm version to 3.10.8 But I am not sure how to upgrade node version to latest. Please suggest. – Oyindrila Bhattacharjee Sep 22 '16 at 13:28
  • @OyindrilaBhattacharjee In my answer I've already shown how to upgrade to Node version 6.6.0. – rsp Sep 22 '16 at 13:39
  • Sorry for late response. Ya I upgraded node and npm according to the steps u gave. When I am doing npm start I am getting the following: vagrant@oyin:~/react-jsonschema-form-master/react-jsonschema-form-master$ npm start > react-jsonschema-form@0.40.0 start /home/vagrant/react-jsonschema-form-master/react-jsonschema-form-master > node devServer.js Listening at http://localhost:8080 webpack built 6094a1c841ed9c4e08a0 in 42337ms Could you please help me how to check the output as a form as I am very new to node – Oyindrila Bhattacharjee Sep 26 '16 at 09:31