我在Ubuntu 16.04中的项目上运行npm install时遇到错误
我无法弄清楚这是npm,execsync或者有角度的问题吗?它在Windows 10中安装和构建很好,这也让我很困惑。我无法启动我的MEAN堆栈网站,因为我无法解决这些错误。
npm -v:3.5.2
这是错误。
> execSync@1.0.2 install /home/tony/web/sa_website/node_modules/execSync
> node install.js
sh: 1: node: not found
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.2
npm WARN @angular/core@2.0.1 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm WARN @angular/http@2.0.1 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm WARN @angular/router@3.0.1 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm ERR! Linux 4.8.0-58-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! execSync@1.0.2 install: `node install.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the execSync@1.0.2 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the execSync 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 information on how to open an issue for this project with:
npm ERR! npm bugs execSync
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls execSync
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/tony/web/sa_website/npm-debug.log
在npm-debug.log
结束时看到的错误640 warn optional Skipping failed optional dependency /chokidar/fsevents:
641 warn notsup Not compatible with your operating system or architecture: fsevents@1.1.2
642 warn @angular/core@2.0.1 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
643 warn @angular/http@2.0.1 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
644 warn @angular/router@3.0.1 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
645 verbose stack Error: execSync@1.0.2 install: `node install.js`
645 verbose stack spawn ENOENT
645 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:17:16)
645 verbose stack at emitTwo (events.js:87:13)
645 verbose stack at ChildProcess.emit (events.js:172:7)
645 verbose stack at maybeClose (internal/child_process.js:821:16)
645 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
646 verbose pkgid execSync@1.0.2
647 verbose cwd /home/tony/web/sa_website
648 error Linux 4.8.0-58-generic
649 error argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
650 error node v4.2.6
651 error npm v3.5.2
652 error file sh
653 error code ELIFECYCLE
654 error errno ENOENT
655 error syscall spawn
656 error execSync@1.0.2 install: `node install.js`
656 error spawn ENOENT
657 error Failed at the execSync@1.0.2 install script 'node install.js'.
657 error Make sure you have the latest version of node.js and npm installed.
657 error If you do, this is most likely a problem with the execSync package,
657 error not with npm itself.
657 error Tell the author that this fails on your system:
657 error node install.js
657 error You can get information on how to open an issue for this project with:
657 error npm bugs execSync
657 error Or if that isn't available, you can get their info via:
657 error npm owner ls execSync
657 error There is likely additional logging output above.
658 verbose exit [ 1, true ]
这是package.json
{
"name": "angular2-nodejs",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"build": "del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch",
"build:prod": "del-cli public/js/app && ngc -p tsconfig.aot.json && ngc -p tsconfig.aot.json && webpack --config webpack.config.prod.js --progress --profile --bail && del-cli 'public/js/app/**/*.js' 'public/js/app/**/*.js.map' '!public/js/app/bundle.js' '!public/js/app/*.chunk.js' 'assets/app/**/*.ngfactory.ts' 'assets/app/**/*.shim.ts'",
"ngc" : "ngc"
},
"dependencies": {
"@angular/common": "2.0.1",
"@angular/compiler": "2.0.1",
"@angular/compiler-cli": "0.6.3",
"@angular/core": "2.0.1",
"@angular/forms": "2.0.1",
"@angular/http": "2.0.1",
"@angular/platform-browser": "2.0.1",
"@angular/platform-browser-dynamic": "2.0.1",
"@angular/platform-server": "2.0.1",
"@angular/router": "3.0.1",
"@angular/upgrade": "2.0.1",
"body-parser": "~1.15.1",
"cookie-parser": "~1.4.3",
"core-js": "^2.4.1",
"debug": "~2.2.0",
"express": "~4.13.4",
"hbs": "~4.0.0",
"morgan": "~1.7.0",
"rxjs": "5.4.3",
"serve-favicon": "~2.3.0",
"zone.js": "^0.6.25"
},
"devDependencies": {
"@types/core-js": "0.9.34",
"@types/node": "6.0.45",
"angular2-router-loader": "^0.3.2",
"angular2-template-loader": "^0.5.0",
"awesome-typescript-loader": "^2.2.4",
"aws-sdk": "^2.79.0",
"del-cli": "^0.2.0",
"express": "^4.13.4",
"file-loader": "^0.11.2",
"html-loader": "^0.4.4",
"image-webpack-loader": "^3.3.1",
"nodemailer": "^4.0.1",
"raw-loader": "^0.5.1",
"typescript": "2.0.3",
"webpack": "2.1.0-beta.21",
"webpack-merge": "^0.14.1"
}
}
答案 0 :(得分:1)
如R. Richards的评论中所述,您的节点版本不受角度支持,只需更新节点
sudo npm install -g n
sudo n latest
然后跑
npm install -g npm
升级npm