我正在运行 npm run dev 来连接我的应用程序以在浏览器中查看,但我不断收到此错误:
> sh:/Users/jasmineanderson/chibi/chibi_hub/client/node_modules/.bin/webpack-dev-server: Permission denied
> npm ERR! code ELIFECYCLE
> npm ERR! errno 126
> npm ERR! chibi_hub@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js` npm ERR!
> Exit status 126 npm ERR! npm ERR!
> Failed at the chibi_hub@1.0.0 dev script. npm ERR!
> This is probably not a problem with npm. There is likely additional logging output
> above.
>
> npm ERR! A complete log of this run can be found in:
> /Users/jasmineanderson/.npm/_logs/2018-10-08T22_43_38_723Z-debug.log
我检查以确保端口8080上没有其他运行,并且仍然出现错误
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using npm@6.4.1
3 info using node@v10.9.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle chibi_hub@1.0.0~predev: chibi_hub@1.0.0
6 info lifecycle chibi_hub@1.0.0~dev: chibi_hub@1.0.0
7 verbose lifecycle chibi_hub@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle chibi_hub@1.0.0~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/jasmineanderson/chibi/chibi_hub/client/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands
9 verbose lifecycle chibi_hub@1.0.0~dev: CWD: /Users/jasmineanderson/chibi/chibi_hub/client
10 silly lifecycle chibi_hub@1.0.0~dev: Args: [ '-c',
10 silly lifecycle 'webpack-dev-server --inline --progress --config build/webpack.dev.conf.js' ]
11 silly lifecycle chibi_hub@1.0.0~dev: Returned: code: 126 signal: null
12 info lifecycle chibi_hub@1.0.0~dev: Failed to exec dev script
13 verbose stack Error: chibi_hub@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:961:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:250:5)
14 verbose pkgid chibi_hub@1.0.0
15 verbose cwd /Users/jasmineanderson/chibi/chibi_hub/client
16 verbose Darwin 17.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v10.9.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 126
22 error chibi_hub@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
22 error Exit status 126
23 error Failed at the chibi_hub@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
我看到问题似乎出在webpack上,但我不确定如何解决。 非常感谢您的帮助!
答案 0 :(得分:0)
从package.json更改/添加开发服务器端口
答案 1 :(得分:0)
权限错误显示所有者可能不是当前用户。 在这种情况下,删除文件夹并重新安装而不使用sudo是正确的答案:)