npm run build出错。更新节点模块或清除缓存不起作用。更新脚本甚至不起作用。无法解决以下错误
0信息,如果它以ok结束它是否有效 1 verbose cli ['C:\ Program Files \ nodejs \ node.exe', 1 verbose cli'C:\ Users \ Bhargavii Nadendla \ AppData \ Roaming \ npm \ node_modules \ npm \ bin \ npm-cli.js', 1 verbose cli'run', 1 verbose cli'build'] 2信息使用npm@6.0.1 3 info使用node@v8.11.2 4详细的run-script ['prebuild','build','postbuild'] 5 info lifecycle udemy-nodejs-angular2@1.0.0~prebuild:udemy-nodejs-angular2@1.0.0 6 info lifecycle udemy-nodejs-angular2@1.0.0~build:udemy-nodejs-angular2@1.0.0 7详细生命周期udemy-nodejs-angular2@1.0.0~build:生命周期中的unsafe-perm为true 8详细生命周期udemy-nodejs-angular2@1.0.0~build:路径:C:\ Users \ Bhargavii Nadendla \ AppData \ Roaming \ npm \ node_modules \ npm \ node_modules \ npm-lifecycle \ node-gyp-bin; C:\用户\ Bhargavii Nadendla \ Desktop \ Angular-Udemy \ seed-project \ node_modules.bin; C:\ Users \ Bhargavii Nadendla \ bin; C:\ Program Files \ Git \ mingw64 \ bin; C:\ Program Files \ Git \ usr \ local \ bin; C:\ Program Files \ Git \ usr \ bin; C:\ Program Files \ Git \ usr \ bin; C:\ Program Files \ Git \ mingw64 \ bin; C:\ Program Files \ Git \ usr \ bin; C:\ Users \ Bhargavii Nadendla \ bin; C:\ Program Files(x86)\ Common Files \ Oracle \ Java \ javapath; C:\ Program Files \ Java \ jdk1.8.0_171 \ bin; C:\ HashiCorp \ Vagrant \ bin; C:\ WINDOWS \ SYSTEM32; C:\ WINDOWS \ System32 \ WindowsPowerShell \ v1.0; C:\ Program Files \ nodejs; C:\ WINDOWS \ system32; C:\ WINDOWS; C:\ WINDOWS \ System32 \ Wbem; C:\ WINDOWS \ System32 \ WindowsPowerShell \ v1.0; C:\ WINDOWS \ System32 \ OpenSSH; C:\ Program Files \ Intel \ WiFi \ bin; C:\ Program Files \ Common Files \ Intel \ WirelessCommon ; C:\ Program Files \ Git \ cmd; C:\ Program Files \ Git \ mingw64 \ bin; C:\ Program Files \ Git \ usr \ b in; C:\ Users \ Bhargavii Nadendla \ Python \ Scripts; C:\ Users \ Bhargavii Nadendla \ Python; C:\ Users \ Bhargavii Nadendla \ AppData \ Local \ Microsoft \ WindowsApps; C:\ Users \ Bhargavii Nadendla \ AppData \ Local \ GitHubDesktop \ bin; C:\ Users \ Bhargavii Nadendla \ AppData \ Roaming \ npm;%USERPROFILE%\ AppData \ Local \ Microsoft \ WindowsApps; C:\ Program Files \ Git \ usr \ bin \ vendor_perl; C:\ Program文件\的Git的\ usr \ BIN \ core_perl 9详细生命周期udemy-nodejs-angular2@1.0.0~build:CWD:C:\ Users \ Bhargavii Nadendla \ Desktop \ Angular-Udemy \ seed-project 10愚蠢的生命周期udemy-nodejs-angular2@1.0.0~build:Args:['/ d / s / c', 10愚蠢的生命周期'del-cli public / js / app&& webpack --config webpack.config.dev.js --progress --profile --watch'] 11傻生命周期udemy-nodejs-angular2@1.0.0~build:返回:代码:1信号:null 12 info lifecycle udemy-nodejs-angular2@1.0.0~build:无法执行构建脚本 13详细堆栈错误:udemy-nodejs-angular2@1.0.0 build:
del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch
13详细堆栈退出状态1 C EventEmitter.emit上的13个详细堆栈(events.js:214:7) ChildProcess上的13个详细堆栈。 (C:\ Users \ Bhargavii Nadendla \ AppData \ Roaming \ npm \ node_modules \ npm \ node_modules \ npm-lifecycle \ lib \ spawn.js:55:14) 在emitTwo有13个详细堆栈(events.js:126:13) ChildProcess.emit上的13个详细堆栈(events.js:214:7) 在maybeClose上的13个详细堆栈(internal / child_process.js:925:16) Process.ChildProcess._handle.onexit上的13个详细堆栈(internal / child_process.js:209:5) 14 verbose pkgid udemy-nodejs-angular2@1.0.0 15 verbose cwd C:\ Users \ Bhargavii Nadendla \ Desktop \ Angular-Udemy \ seed-project 16详细的Windows_NT 10.0.17134 17 verbose argv“C:\ Program Files \ nodejs \ node.exe”“C:\ Users \ Bhargavii Nadendla \ AppData \ Roaming \ npm \ node_modules \ npm \ bin \ npm-cli.js”“run”“build” 18详细节点v8.11.2 19详细npm v6.0.1 20错误代码ELIFECYCLE 21错误错误1 22错误udemy-nodejs-angular2@1.0.0 build:del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch
22错误退出状态1 23错误udemy-nodejs-angular2@1.0.0构建脚本失败。 23错误这可能不是npm的问题。上面可能有额外的日志记录输出。 24详细退出[1,true]
在这里,我上传了package.json
{
"name": "udemy-nodejs-angular2",
"version": "1.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 'assets/app/**/*.js' 'assets/app/**/*.ngsummary.json' 'assets/app/**/*.ngstyle.*'"
},
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/platform-server": "^5.0.0",
"@angular/router": "^5.0.0",
"@angular/upgrade": "^5.0.0",
"body-parser": "~1.15.2",
"cookie-parser": "~1.4.3",
"core-js": "^2.4.1",
"debug": "~2.2.0",
"express": "~4.14.0",
"hbs": "~3.1.0",
"mongoose": "^5.1.3",
"mongoose-unique-validator": "^2.0.1",
"morgan": "~1.6.1",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.5.11",
"serve-favicon": "~2.3.0",
"zone.js": "^0.8.5"
},
"devDependencies": {
"@ngtools/webpack": "^1.8.0",
"@types/core-js": "0.9.36",
"@types/node": "^6.0.45",
"angular-router-loader": "^0.5.0",
"angular2-template-loader": "^0.5.0",
"awesome-typescript-loader": "^3.1.2",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"del-cli": "^0.2.0",
"html-loader": "^0.4.4",
"raw-loader": "^0.5.1",
"ts-loader": "^2.0.3",
"typescript": "^2.4.2",
"webpack": "^2.7.0",
"webpack-merge": "^4.1.0"
}
}
答案 0 :(得分:2)
我已经在你的同一个package.json上安装了ubuntu,它运行得很好。
我使用节点V8.11,npm 6.10;
您的计算机和节点8.0似乎正在使用节点6.0;
首先,一个好的尝试是将你的npm更新到6.10并将你的节点更新到更新的版本,或者只是重新安装节点。但是更有可能是你的用户没有权限完成构建过程,你可以在
中看到`
14 verbose pkgid udemy-nodejs-angular2@1.0.0
15 verbose cwd C:\Users\Bhargavii Nadendla\Desktop\Angular-Udemy\seed-project
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Bhargavii Nadendla\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v8.11.2
19 verbose npm v6.0.1
20 error code ELIFECYCLE
21 error errno 1
22 error udemy-nodejs-angular2@1.0.0 build: `del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch`
22 error Exit status 1
`
每当发生这种情况时,我只是在ubuntu上运行sudo并修复它。您的用户在project folder node_modules
和"C:\\Users\\Bhargavii Nadendla\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js"
中的权限是什么?
如果它与权限无关,请尝试安装较新版本的节点并将其指向C:从Windows的AppData中删除它,这实际上可能导致访问权限失败。