gpt4 book ai didi

angular - Ubuntu 16.04 上的 NPM 安装错误,但 Windows 10 上没有

转载 作者:行者123 更新时间:2023-12-04 18:45:21 25 4
gpt4 key购买 nike

我在 Ubuntu 16.04 的项目上运行 npm install 时出错

我不知道这是否是 npm 或 execsync 或 angular 的问题?它在 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"
}
}

最佳答案

正如 R. Richards 在评论中提到的, Angular 不支持您的节点版本,只需使用更新节点sudo npm install -g n
sudo n latest
然后就跑npm install -g npm升级 npm

关于angular - Ubuntu 16.04 上的 NPM 安装错误,但 Windows 10 上没有,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46507174/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com