gpt4 book ai didi

javascript - npm run build 出错

转载 作者:行者123 更新时间:2023-12-01 02:00:04 26 4
gpt4 key购买 nike

npm run build 时出错。更新 Node 模块或清除缓存不起作用。更新脚本甚至不起作用。无法解决以下错误

0 info it worked if it ends with 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 info using npm@6.0.1 3 info using node@v8.11.2 4 verbose 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 verbose lifecycle udemy-nodejs-angular2@1.0.0~build: unsafe-perm in lifecycle true 8 verbose lifecycle udemy-nodejs-angular2@1.0.0~build: PATH: C:\Users\Bhargavii Nadendla\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\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\bin;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 Files\Git\usr\bin\core_perl 9 verbose lifecycle udemy-nodejs-angular2@1.0.0~build: CWD: C:\Users\Bhargavii Nadendla\Desktop\Angular-Udemy\seed-project 10 silly lifecycle udemy-nodejs-angular2@1.0.0~build: Args: [ '/d /s /c', 10 silly lifecycle 'del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch' ] 11 silly lifecycle udemy-nodejs-angular2@1.0.0~build: Returned: code: 1 signal: null 12 info lifecycle udemy-nodejs-angular2@1.0.0~build: Failed to exec build script 13 verbose stack Error: udemy-nodejs-angular2@1.0.0 build: del-cli public/js/app && webpack --config webpack.config.dev.js --progress --profile --watch 13 verbose stack Exit status 1 c 13 verbose stack at EventEmitter.emit (events.js:214:7) 13 verbose stack at ChildProcess. (C:\Users\Bhargavii Nadendla\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at emitTwo (events.js:126:13) 13 verbose stack at ChildProcess.emit (events.js:214:7) 13 verbose stack at maybeClose (internal/child_process.js:925:16) 13 verbose stack at Process.ChildProcess._handle.onexit (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 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 23 error Failed at the udemy-nodejs-angular2@1.0.0 build script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 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"
}
}

最佳答案

我已经在你的同一个 package.json 上安装了 ubuntu,并且运行得很好。

我正在使用 Node V8.11,npm 6.10;

看来您的机器使用的是node 6.0,而node 8.0;

首先,一个好的尝试是将 npm 更新到 6.10,将 Node 更新到更新版本,或者只是重新安装 Node。但更可能的是您的用户无权完成构建过程,如您在

中看到的
`
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 即可修复。您的用户在项目文件夹node_modules中以及在"C:\\Users\\Bhargavii Nadendla\\AppData\\Roaming\\npm\\node_modules\\中拥有哪些权限npm\\bin\\npm-cli.js" ?

如果不是权限相关,请尝试安装较新版本的node,并指向C:从windows的AppData中删除,这样实际上会导致访问权限失败。

关于javascript - npm run build 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50671163/

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