摘要:直接全局安装是会出现错误错误如下这种错误提示是你没有权限将安装文件直接写入一个权限控制文件里。
直接 npm install -g @vue/cli全局安装是会出现错误
错误如下:
Last login: Tue Oct 30 23:43:58 on ttys000 asusdeMac:~ asus$ npm install -g @vue/cli npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm WARN apollo-link-persisted-queries@0.2.1 requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN graphql-subscriptions@0.5.8 requires a peer of graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN @apollographql/apollo-upload-server@5.0.3 requires a peer of graphql@^0.13.1 but none is installed. You must install peer dependencies yourself. npm WARN graphql-tools@3.1.1 requires a peer of graphql@^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN graphql-subscriptions@0.5.8 requires a peer of graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself. npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access "/usr/local/lib/node_modules" npm ERR! { Error: EACCES: permission denied, access "/usr/local/lib/node_modules" npm ERR! stack: "Error: EACCES: permission denied, access "/usr/local/lib/node_modules"", npm ERR! errno: -13, npm ERR! code: "EACCES", npm ERR! syscall: "access", npm ERR! path: "/usr/local/lib/node_modules" } 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 (though this is not recommended). npm ERR! A complete log of this run can be found in: npm ERR! /Users/asus/.npm/_logs/2018-10-31T06_48_54_915Z-debug.log
这种错误提示是你没有权限将安装文件直接写入一个权限控制文件里。
npm全局安装文件时可以使用 ‘sudo’ 任何管理员账户都可以使用sudo来获取 root 权限。
使用 sudo npm install -g @vue/cli 进行安装
1、输入安装命令后,命令提醒你输入Password密码,目的使用管理员权限去安装
Last login: Tue Oct 30 23:44:47 on ttys000 asusdeMac:~ asus$ sudo npm install -g @vue/cli We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. Password:
密码输入完后稍等一会儿就安装成功啦!
asusdeMac:~ asus$ sudo npm install -g @vue/cli npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead /usr/local/bin/vue -> /usr/local/lib/node_modules/@vue/cli/bin/vue.js > fsevents@1.2.4 install /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents > node install [fsevents] Success: "/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed Pass --update-binary to reinstall or --build-from-source to recompile > protobufjs@6.8.8 postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/protobufjs > node scripts/postinstall > nodemon@1.18.5 postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/nodemon > node bin/postinstall || exit 0 Love nodemon? You can now support the project via the open collective: > https://opencollective.com/nodemon/donate npm WARN graphql-subscriptions@0.5.8 requires a peer of graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN apollo-link-persisted-queries@0.2.1 requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN graphql-subscriptions@0.5.8 requires a peer of graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN @apollographql/apollo-upload-server@5.0.3 requires a peer of graphql@^0.13.1 but none is installed. You must install peer dependencies yourself. npm WARN graphql-tools@3.1.1 requires a peer of graphql@^0.13.0 but none is installed. You must install peer dependencies yourself. + @vue/cli@3.0.5 added 730 packages from 514 contributors in 167.036s
检测是否在全局安装成功 输入命令 vue -v
asusdeMac:~ asus$ vue -v Usage: vue[options] Options: -V, --version output the version number -h, --help output usage information Commands: create [options] create a new project powered by vue-cli-service add [pluginOptions] install a plugin and invoke its generator in an already created project invoke [pluginOptions] invoke the generator of a plugin in an already created project inspect [options] [paths...] inspect the webpack config in a project with vue-cli-service serve [options] [entry] serve a .js or .vue file in development mode with zero config build [options] [entry] build a .js or .vue file in production mode with zero config ui [options] start and open the vue-cli ui init [options] generate a project from a remote template (legacy API, requires @vue/cli-init) config [options] [value] inspect and modify the config Run vue --help for detailed usage of given command. Unknown option -v.
接下来你就可以进行你的vue.js脚手架搭建啦
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/98872.html
摘要:下面来就来讲讲脚手架的安装吧。如何安装安装只需要在终端下输入下面一条命令自带不需要安装安装完成后使用即可。原因是的问题,要求版本是。想用安装,就必须用安装一下。 前言 Vue作为前端三大框架(Angular,React,Vue)之一,号称是最简单,最容易上手的框架,同时也是行内的大趋势,还可以用来开发最火的小程序。具有开发快,双向数据流等特点,有些人认为Vue是Angular和Reac...
摘要:下面来就来讲讲脚手架的安装吧。如何安装安装只需要在终端下输入下面一条命令自带不需要安装安装完成后使用即可。原因是的问题,要求版本是。想用安装,就必须用安装一下。 前言 Vue作为前端三大框架(Angular,React,Vue)之一,号称是最简单,最容易上手的框架,同时也是行内的大趋势,还可以用来开发最火的小程序。具有开发快,双向数据流等特点,有些人认为Vue是Angular和Reac...
摘要:中使用和不是特别符合原生的写法,但是有时候又要用,所以放上我的引入设置,供大家参考。其中用于在中显示弹窗提示下拉菜单,所以需要引入。因为我的文件经过了我自己的调整,所以单独放在文件夹中做单独引入。 Vue 中使用 jQuery 和 Bootstrap 不是特别符合 Vue 原生的写法,但是有时候又要用,所以放上我的引入设置,供大家参考。 在 Vue CLI2.0 中引入 jQuery ...
阅读 2416·2021-11-16 11:44
阅读 1876·2021-10-12 10:12
阅读 2158·2021-09-22 15:22
阅读 3007·2021-08-11 11:17
阅读 1504·2019-08-29 16:53
阅读 2653·2019-08-29 14:09
阅读 3472·2019-08-29 14:03
阅读 3298·2019-08-29 11:09