npm开始给怪异的错误8与意外的令牌非法

我得到奇怪的错误8与下面的输出,而做$ npm开始

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

节点-v v0.10.25

我已经安装了nodejs-legacy

 $ which node /usr/bin/node $ which nodejs /usr/bin/nodejs 

有人可以帮忙吗?

我试图在ubuntu 14.04上运行react-jsonschema-form或者word-finder( https://github.com/amirrajan/word-finder )

您正在使用节点0.10 – 目前LTS版本是4.5.0,当前版本是6.6.0。 考虑升级Node,因为您使用的是过时的版本。 节点0.10于2013年3月发布,其维护期结束于一周(2016年10月1日),然后将不再获得任何更新,请参阅: https : //github.com/nodejs/LTS#lts_schedule

根据github.com/mozilla-services/react-jsonschema-form中的package.json ,所需的Node版本至less是6.x和npm 2.14.7。 您正试图在Node v0.10.25和npm 1.3.10上运行它。 你不应该期待它的工作。

要安装现代版本的Node,您可以从https://nodejs.org/下载二进制版本,也可以从源代码构build它,例如使用类似于以下的过程:

如果你想在/usr/local安装node并且可以用/usr/local/bin/node你可以这样做:

 # 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" 

或者,如果您希望能够同时安装几个版本,则使用默认的符号链接:

 # 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" 

看到这个答案更多的信息。