npm run serve打开项目时报错errno 126

新手上路,请多包涵

问题描述

npm run serve打开项目时报错

问题出现的环境背景及自己尝试过哪些方法

以为是项目文件没有权限导致,给过权限发现不行

报错信息

// 请把代码文本粘贴到下方(请勿用图片代替代码)
192:happylearn-admin-html helloimyhe$ npm run serve

happylearn-admin-html@0.1.0 serve /Users/helloimyhe/Documents/happylearn-admin-html/trunk/happylearn-admin-html
vue-cli-service serve

sh: /Users/helloimyhe/Documents/happylearn-admin-html/trunk/happylearn-admin-html/node_modules/.bin/vue-cli-service: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! happylearn-admin-html@0.1.0 serve: vue-cli-service serve
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the happylearn-admin-html@0.1.0 serve 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:
npm ERR! /Users/helloimyhe/.npm/_logs/2018-11-30T03_23_08_571Z-debug.log

debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'serve' ]
2 info using npm@6.4.1
3 info using node@v10.14.0
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle happylearn-admin-html@0.1.0~preserve: happylearn-admin-html@0.1.0
6 info lifecycle happylearn-admin-html@0.1.0~serve: happylearn-admin-html@0.1.0
7 verbose lifecycle happylearn-admin-html@0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle happylearn-admin-html@0.1.0~serve: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/helloimyhe/Documents/happylearn-admin-html/trunk/happylearn-admin-html/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle happylearn-admin-html@0.1.0~serve: CWD: /Users/helloimyhe/Documents/happylearn-admin-html/trunk/happylearn-admin-html
10 silly lifecycle happylearn-admin-html@0.1.0~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 silly lifecycle happylearn-admin-html@0.1.0~serve: Returned: code: 126 signal: null
12 info lifecycle happylearn-admin-html@0.1.0~serve: Failed to exec serve script
13 verbose stack Error: happylearn-admin-html@0.1.0 serve: vue-cli-service serve
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:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid happylearn-admin-html@0.1.0
15 verbose cwd /Users/helloimyhe/Documents/happylearn-admin-html/trunk/happylearn-admin-html
16 verbose Darwin 18.2.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "serve"
18 verbose node v10.14.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 126
22 error happylearn-admin-html@0.1.0 serve: vue-cli-service serve
22 error Exit status 126
23 error Failed at the happylearn-admin-html@0.1.0 serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]

阅读 15.8k
2 个回答
新手上路,请多包涵

错误信息已经提示了/Users/helloimyhe/Documents/happylearn-admin-html/trunk/happylearn-admin-html/node\_modules/.bin/vue-cli-service: Permission denied没有权限;
需执行命令:

chmod 777 /Users/helloimyhe/Documents/happylearn-admin-html/trunk/happylearn-admin-html/node\_modules/.bin/vue-cli-service

然后重新执行

npm run serve

我也遇到了这么问题,在网上看到了别的大神把这个问题解决了,解决方案是在根目录下新建一个vue.config.js文件,里边配上
`module.exports = {

devServer: {
    clientLogLevel: 'info'
}

};`
附上原网页链接:https://github.com/vuejs/vue-...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进