我正在学习Vue.JS,我需要安装Vue CLI。
NodeJS : v13.8.0 Vue CLI : v4.2.2
我安装NodeJS没有问题,但是当我在终端上打开我的文件夹并用(npm install -g @ Vue / CLI )安装vue cli时,我得到了很多错误。
MacBook-Pro-de-Cedric:excli cedric$ npm install -g @vue/cli
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@vue/cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@vue/cli/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@vue
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/@vue/cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/@vue/cli'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/@vue/cli'] {
npm ERR! stack: "Error: EACCES: permission denied, access '/usr/local/lib/node_modules/@vue/cli'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/@vue/cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/cedric/.npm/_logs/2020-02-09T15_09_00_595Z-debug.log我可以使用以下命令通过终端创建一个项目:(vue create npm project ),但它也包含错误,我不能启动npm run serve。
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:321:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/cedric/Documents/Projets Site Web : Apps/VueJs/excli/projet/node_modules/fsevents
gyp ERR! node -v v13.8.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
Successfully created project projet.
Get started with the following commands:
$ cd projet
$ npm run serve
MacBook-Pro-de-Cedric:excli cedric$ npm run serve
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/cedric/Documents/Projets Site Web : Apps/VueJs/excli/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/cedric/Documents/Projets Site Web : Apps/VueJs/excli/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/cedric/.npm/_logs/2020-02-09T15_18_01_082Z-debug.log如果有人知道我如何解决这个问题,那就太好了。谢谢
发布于 2020-11-18 05:50:58
如果您使用的是mac,那么可以尝试使用sudo npm install -g @vue/cli而不是npm install -g @vue/cli来进行全局安装。
发布于 2020-12-17 16:22:55
因为没有找到Node模块的路径,你可以直接输入sudo npm install -g @vue/cli来安装Vue,也就是在全局环境下安装vue,你也可以重新设置你的节点模块路径。
发布于 2021-06-01 22:20:44
你必须以超级用户权限执行npm install -g (以linux上的sudo为例),因为你的npm目录似乎在超级用户权限之下。
https://stackoverflow.com/questions/60138150
复制相似问题