vue-cli-service:运行npm run serve时权限被拒绝

时间:2020-06-18 15:44:58

标签: node.js vue.js npm vuejs2 vue-cli

我正在尝试运行简单的vue项目。但是,由于某种原因,我无法在我的 openSUSE TW (20200615)系统上运行它。我正在使用NVM进行节点安装。以下是我的环境

 nvm --version  # 0.35.3
 node --version # v14.4.0
 npm --version # 6.14.5
 vue --version # @vue/cli 4.4.4

我正在遵循典型的hello world教程

vue create hello-world  
cd hello-world
npm run serve

我遇到以下错误

> hello-world@0.1.0 serve /path/to/hello-world
> vue-cli-service serve

sh: /path/to/hello-world/node_modules/.bin/vue-cli-service: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! hello-world@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the hello-world@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!     /home/user/.npm/_logs/2020-06-18T15_03_14_259Z-debug.log

我已经尝试了许多操作,例如删除node_modules,然后再次安装,如建议的herehere。尝试按照建议的here使用root帐户。我什至尝试全局安装node并执行此操作,但仍然是相同的错误。我试图将所有node_module文件的权限更改为777并运行。自从最近2个小时尝试了所有这些方法之后,我仍然遇到相同的错误。谁能告诉我发生了什么事?

如果有人需要,这里是日志文件(2020-06-18T15_03_14_259Z-debug.log)。

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/user/.nvm/versions/node/v14.4.0/bin/node',
1 verbose cli   '/home/user/.nvm/versions/node/v14.4.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'serve'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v14.4.0
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle hello-world@0.1.0~preserve: hello-world@0.1.0
6 info lifecycle hello-world@0.1.0~serve: hello-world@0.1.0
7 verbose lifecycle hello-world@0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle hello-world@0.1.0~serve: PATH: /home/user/.nvm/versions/node/v14.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/path/to/hello-world/node_modules/.bin:/home/user/.nvm/versions/node/v14.4.0/bin:/home/user/Android/Sdk/platform-tools:/var/lib/snapd/snap/bin:/usr/bin:/home/user/.pyenv/bin:/home/user/bin:/usr/local/bin:/home/user/bin:/usr/local/bin:/usr/bin:/bin:/snap/bin
9 verbose lifecycle hello-world@0.1.0~serve: CWD: /path/to/hello-world
10 silly lifecycle hello-world@0.1.0~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 silly lifecycle hello-world@0.1.0~serve: Returned: code: 126  signal: null
12 info lifecycle hello-world@0.1.0~serve: Failed to exec serve script
13 verbose stack Error: hello-world@0.1.0 serve: `vue-cli-service serve`
13 verbose stack Exit status 126
13 verbose stack     at EventEmitter.<anonymous> (/home/user/.nvm/versions/node/v14.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/home/user/.nvm/versions/node/v14.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid hello-world@0.1.0
15 verbose cwd /path/to/hello-world
16 verbose Linux 5.7.1-1-default
17 verbose argv "/home/user/.nvm/versions/node/v14.4.0/bin/node" "/home/user/.nvm/versions/node/v14.4.0/bin/npm" "run" "serve"
18 verbose node v14.4.0
19 verbose npm  v6.14.5
20 error code ELIFECYCLE
21 error errno 126
22 error hello-world@0.1.0 serve: `vue-cli-service serve`
22 error Exit status 126
23 error Failed at the hello-world@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 ]

0 个答案:

没有答案