$node -v
v0.12.7
$npm -v
2.11.3
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
我在这里挣扎。我试图安装我的节点模块,但没有成功。我有一个带有一些旧依赖项的项目,这迫使我使用上面提到的Node版本。
有问题的错误如下:
npm ERR! Linux 4.4.0-116-generic
npm ERR! argv "/home/vagrant/.nvm/versions/node/v0.12.7/bin/node" "/home/vagrant/.nvm/versions/node/v0.12.7/bin/npm" "install"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.16 install script 'node install.js'.
npm ERR! This is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/vagrant/Code/saas-app/npm-debug.log
我还会遇到多个错误,如下所示:
> node-sass@3.13.1 install /home/vagrant/Code/saas-app/node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/node-sass
> node scripts/install.js
/home/vagrant/Code/saas-app/node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/node-sass/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
const Hoek = require('hoek');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/vagrant/Code/saas-app/node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/node-sass/node_modules/request/node_modules/hawk/lib/index.js:5:33)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
-
> uws@9.14.0 install /home/vagrant/Code/saas-app/node_modules/laravel-elixir/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0
您可以找到整个输出here和npm-debug.log。
对于npm和节点来说是非常新的(即使这与节点编程并不相关),我在调试这个问题并找出解决问题的方法时遇到了困难。
由于安装了较新版本,我通过0.12.7
将节点版本更改为nvm
。在较新的版本中,我遇到了不同的错误,这些错误并没有让我继续下去。
我的packages.json
看起来像这样:
{
"private": true,
"devDependencies": {
"browserify": "^14.4.0",
"gulp": "^3.8.8",
"gulp-notify": "~2.2.0",
"jasmine-core": "^2.6.4",
"karma": "^1.7.0",
"karma-browserify": "^5.1.1",
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.4",
"watchify": "^3.9.0"
},
"dependencies": {
"bootstrap-sass": "^3.0.0",
"ioredis": "^1.9.1",
"jsonwebtoken": "^5.4.1",
"laravel-elixir": "^3.0.0",
"mysql": "^2.11.1",
"node-env-file": "^0.1.8",
"shelljs": "^0.5.3",
"socket.io": "^1.3.7",
"through": "^2.3.8"
}
}