我是Angular2的新手,当我尝试在项目文件夹中使用npm start
启动npm服务器时,我遇到了这些错误
> angular2-authentication-sample@0.0.1 start /home/no-one/Desktop/Frontend
> npm run front
> angular2-authentication-sample@0.0.1 front /home/no-one/Desktop/Frontend
> webpack-dev-server --inline -d --colors --display-error-details --display-cached --port 3000
sh: 1: webpack-dev-server: Permission denied
npm ERR! Linux 3.19.0-51-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "front"
npm ERR! node v5.6.0
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! angular2-authentication-sample@0.0.1 front: `webpack-dev-server --inline -d --colors --display-error-details --display-cached --port 3000`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the angular2-authentication-sample@0.0.1 front script 'webpack-dev-server --inline -d --colors --display-error-details --display-cached --port 3000'.
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 angular2-authentication-sample package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server --inline -d --colors --display-error-details --display-cached --port 3000
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-authentication-sample
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular2-authentication-sample
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/no-one/Desktop/Frontend/npm-debug.log
这是npm-debug.log内容:
> 0 info it worked if it ends with ok 1 verbose cli [
> '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ] 2 info using
> npm@3.7.3 3 info using node@v5.6.0 4 verbose run-script [ 'prestart',
> 'start', 'poststart' ] 5 info lifecycle
> angular2-authentication-sample@0.0.1~prestart:
> angular2-authentication-sample@0.0.1 6 silly lifecycle
> angular2-authentication-sample@0.0.1~prestart: no script for prestart,
> continuing 7 info lifecycle
> angular2-authentication-sample@0.0.1~start:
> angular2-authentication-sample@0.0.1 8 verbose lifecycle
> angular2-authentication-sample@0.0.1~start: unsafe-perm in lifecycle
> true 9 verbose lifecycle angular2-authentication-sample@0.0.1~start:
> PATH:
> /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/no-one/Desktop/Frontend/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
> 10 verbose lifecycle angular2-authentication-sample@0.0.1~start: CWD:
> /home/no-one/Desktop/Frontend 11 silly lifecycle
> angular2-authentication-sample@0.0.1~start: Args: [ '-c', 'npm run
> front' ] 12 silly lifecycle
> angular2-authentication-sample@0.0.1~start: Returned: code: 1 signal:
> null 13 info lifecycle angular2-authentication-sample@0.0.1~start:
> Failed to exec start script 14 verbose stack Error:
> angular2-authentication-sample@0.0.1 start: `npm run front` 14 verbose
> stack Exit status 1 14 verbose stack at EventEmitter.<anonymous>
> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:239:16) 14
> verbose stack at emitTwo (events.js:100:13) 14 verbose stack
> at EventEmitter.emit (events.js:185:7) 14 verbose stack at
> ChildProcess.<anonymous>
> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14) 14 verbose
> stack at emitTwo (events.js:100:13) 14 verbose stack at
> ChildProcess.emit (events.js:185:7) 14 verbose stack at maybeClose
> (internal/child_process.js:827:16) 14 verbose stack at
> Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
> 15 verbose pkgid angular2-authentication-sample@0.0.1 16 verbose cwd
> /home/no-one/Desktop/Frontend 17 error Linux 3.19.0-51-generic 18
> error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" 19 error
> node v5.6.0 20 error npm v3.7.3 21 error code ELIFECYCLE 22 error
> angular2-authentication-sample@0.0.1 start: `npm run front` 22 error
> Exit status 1 23 error Failed at the
> angular2-authentication-sample@0.0.1 start script 'npm run front'. 23
> error Make sure you have the latest version of node.js and npm
> installed. 23 error If you do, this is most likely a problem with the
> angular2-authentication-sample package, 23 error not with npm itself.
> 23 error Tell the author that this fails on your system: 23 error
> npm run front 23 error You can get information on how to open an issue
> for this project with: 23 error npm bugs
> angular2-authentication-sample 23 error Or if that isn't available,
> you can get their info via: 23 error npm owner ls
> angular2-authentication-sample 23 error There is likely additional
> logging output above. 24 verbose exit [ 1, true ]
PS:这个项目在其他平台(Windows)上运行良好,没有任何错误,即使我将npm
和nodeJs
升级到最新版本,但错误仍然存在。
请提前帮助和致谢!
答案 0 :(得分:1)
我可以在您的日志中看到权限被拒绝。您是否有权执行webpack-dev-server
命令? chmod 755
可以解决您的问题......
请看这个链接: