安装Vue Js时出现以下npm错误

时间:2020-08-12 10:34:34

标签: node.js vue.js npm

我在我的Parrot OS系统上使用Snap安装了Node.js。

我不知道为什么,但是在node_modules之后没有/usr/local/lib文件夹

这是我npm install -g @vue/cli遇到的错误

npm WARN deprecated @hapi/joi@15.1.1: joi is leaving the @hapi organization and moving back to 'joi' (https://github.com/sideway/joi/issues/2411)
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/address@2.1.4: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
/usr/local/bin/vue -> /usr/local/lib/node_modules/@vue/cli/bin/vue.js
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/2913/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> core-js@3.6.5 postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

2020/08/12 15:51:38.149740 cmd_run.go:918: WARNING: cannot create user data directory: cannot create "/nonexistent/snap/node/2913": mkdir /nonexistent: permission denied
cannot create user data directory: /nonexistent/snap/node/2913: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/@vue/cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN @vue/compiler-sfc@3.0.0-rc.5 requires a peer of vue@3.0.0-rc.5 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! core-js@3.6.5 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the core-js@3.6.5 postinstall 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!     /root/.npm/_logs/2020-08-12T10_21_41_518Z-debug.log

编辑:-

在使用sudo时出现以下错误-sudo: npm: command not found。因此,我先运行了su,然后尝试了npm install -g @vue/cli,但随后出现了最初在问题中提出的错误。

1 个答案:

答案 0 :(得分:1)

在全局安装sudo npm install -g @vue/cli软件包时,必须以管理员身份运行install命令。

尝试运行,

{{1}}

相关问题