vue-cli
Vue.js作为当前最热门的前端开发框架,已成为了前端开发者必学的内容之一。但是Vue环境的搭建稍显复杂和繁琐,项目的构建也没那么方便。
为了解决这个问题,Vue官方提供了Vue CLI。
Vue CLI是一个全局安装的 npm 包,提供了终端里的 vue 命令。
它可以通过 vue create 快速创建一个新项目的脚手架,或者直接通过 vue serve 构建新想法的原型。
你也可以通过 vue ui 通过一套图形化界面管理你的所有项目。
@vue/cli安装
cnpm install -g @vue/cli
或者yarn global add @vue/cli
MacBookPro:node_modules zhangxm$ sudo cnpm install -g @vue/cli
Downloading @vue/cli to /usr/local/lib/node_modules/@vue/cli_tmp
Copying /usr/local/lib/node_modules/@vue/cli_tmp/_@[email protected]@@vue/cli to /usr/local/lib/node_modules/@vue/cli
Installing @vue/cli's dependencies to /usr/local/lib/node_modules/@vue/cli/node_modules
[1/36] deepmerge@^3.2.0 installed at node_modules/[email protected]@deepmerge
[2/36] commander@^2.20.0 installed at node_modules/[email protected]@commander
[3/36] @vue/cli-ui-addon-webpack@^4.1.1 installed at node_modules/_@[email protected]@@vue/cli-ui-addon-webpack
[4/36] didyoumean@^1.2.1 installed at node_modules/[email protected]@didyoumean
[5/36] @vue/cli-ui-addon-widgets@^4.1.1 installed at node_modules/_@[email protected]@@vue/cli-ui-addon-widgets
[6/36] execa@^1.0.0 existed at node_modules/[email protected]@execa
[7/36] debug@^4.1.0 installed at node_modules/[email protected]@debug
[8/36] cmd-shim@^2.0.2 installed at node_modules/[email protected]@cmd-shim
[9/36] ejs@^2.7.1 installed at node_modules/[email protected]@ejs
[10/36] chalk@^2.4.1 installed at node_modules/[email protected]@chalk
[11/36] envinfo@^7.5.0 installed at node_modules/[email protected]@envinfo
[12/36] fs-extra@^7.0.1 installed at node_modules/[email protected]@fs-extra
[13/36] boxen@^4.1.0 installed at node_modules/[email protected]@boxen
[14/36] isbinaryfile@^4.0.0 installed at node_modules/[email protected]@isbinaryfile
[15/36] javascript-stringify@^1.6.0 installed at node_modules/[email protected]@javascript-stringify
[16/36] lru-cache@^5.1.1 existed at node_modules/[email protected]@lru-cache
[17/36] import-global@^0.1.0 installed at node_modules/[email protected]@import-global
[18/36] lodash.clonedeep@^4.5.0 installed at node_modules/[email protected]@lodash.clonedeep
[19/36] request@^2.87.0 existed at node_modules/[email protected]@request
[20/36] request-promise-native@^1.0.8 existed at node_modules/[email protected]@request-promise-native
[21/36] minimist@^1.2.0 installed at node_modules/[email protected]@minimist
[22/36] semver@^6.1.0 existed at node_modules/[email protected]@semver
[23/36] @vue/cli-shared-utils@^4.1.1 installed at node_modules/_@[email protected]@@vue/cli-shared-utils
[24/36] js-yaml@^3.13.1 installed at node_modules/[email protected]@js-yaml
[25/36] resolve@^1.13.0 installed at node_modules/[email protected]@resolve
[26/36] inquirer@^6.3.1 installed at node_modules/[email protected]@inquirer
[27/36] slash@^3.0.0 installed at node_modules/[email protected]@slash
[28/36] shortid@^2.2.15 installed at node_modules/[email protected]@shortid
[29/36] recast@^0.18.1 installed at node_modules/[email protected]@recast
[30/36] validate-npm-package-name@^3.0.0 installed at node_modules/[email protected]@validate-npm-package-name
[31/36] download-git-repo@^1.0.2 installed at node_modules/[email protected]@download-git-repo
[32/36] yaml-front-matter@^3.4.1 installed at node_modules/[email protected]@yaml-front-matter
[33/36] globby@^9.2.0 installed at node_modules/[email protected]@globby
[34/36] vue-jscodeshift-adapter@^2.0.2 installed at node_modules/[email protected]@vue-jscodeshift-adapter
[35/36] jscodeshift@^0.6.4 installed at node_modules/[email protected]@jscodeshift
[npminstall:runscript] @vue/[email protected] › [email protected] › [email protected] › [email protected] › fsevents@^1.2.7 found binding.gyp file, auto run "node-gyp rebuild", root: "/usr/local/lib/node_modules/@vue/cli/node_modules/[email protected]@fsevents"
gyp http GET https://npm.taobao.org/mirrors/node/v12.13.1/node-v12.13.1-headers.tar.gz
gyp http 200 https://npm.taobao.org/mirrors/node/v12.13.1/node-v12.13.1-headers.tar.gz
gyp http GET https://npm.taobao.org/mirrors/node/v12.13.1/SHASUMS256.txt
gyp http 200 https://npm.taobao.org/mirrors/node/v12.13.1/SHASUMS256.txt
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
[36/36] @vue/cli-ui@^4.1.1 installed at node_modules/_@[email protected]@@vue/cli-ui
execute post install 5 scripts...
[1/5] scripts.postinstall ejs@^2.7.1 run "node ./postinstall.js", root: "/usr/local/lib/node_modules/@vue/cli/node_modules/[email protected]@ejs"
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
[1/5] scripts.postinstall ejs@^2.7.1 finished in 82ms
[2/5] scripts.postinstall @vue/[email protected] › [email protected] › [email protected] › @apollographql/[email protected] › [email protected] › core-js@^3.0.1 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "/usr/local/lib/node_modules/@vue/cli/node_modules/[email protected]@core-js"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
[2/5] scripts.postinstall @vue/[email protected] › [email protected] › [email protected] › @apollographql/[email protected] › [email protected] › core-js@^3.0.1 finished in 81ms
[3/5] scripts.postinstall @vue/[email protected] › [email protected] › [email protected] › [email protected] › [email protected] › @apollo/protobufjs@^1.0.3 run "node scripts/postinstall", root: "/usr/local/lib/node_modules/@vue/cli/node_modules/_@[email protected]@@apollo/protobufjs"
[3/5] scripts.postinstall @vue/[email protected] › [email protected] › [email protected] › [email protected] › [email protected] › @apollo/protobufjs@^1.0.3 finished in 82ms
[4/5] scripts.postinstall @vue/[email protected] › [email protected] › [email protected] › [email protected] › [email protected] › core-js@^2.5.0 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "/usr/local/lib/node_modules/@vue/cli/node_modules/[email protected]@core-js"
[4/5] scripts.postinstall @vue/[email protected] › [email protected] › [email protected] › [email protected] › [email protected] › core-js@^2.5.0 finished in 73ms
[5/5] scripts.postinstall @vue/[email protected] › [email protected] › nodemon@^1.19.4 run "node bin/postinstall || exit 0", root: "/usr/local/lib/node_modules/@vue/cli/node_modules/[email protected]@nodemon"
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
[5/5] scripts.postinstall @vue/[email protected] › [email protected] › nodemon@^1.19.4 finished in 184ms
anti semver @vue/[email protected] › [email protected] › [email protected] › @types/[email protected] › @types/express@* delcares @types/express@*(resolved as 4.17.2) but using ancestor(apollo-server-express)'s dependency @types/[email protected](resolved as 4.17.1)
anti semver @vue/[email protected] › [email protected] › [email protected] › [email protected] › @types/[email protected] › @types/express@* delcares @types/express@*(resolved as 4.17.2) but using ancestor(apollo-server-express)'s dependency @types/[email protected](resolved as 4.17.1)
anti semver @vue/[email protected] › [email protected] › [email protected] › [email protected] › @types/[email protected] › @types/[email protected] › @types/[email protected] › @types/express@* delcares @types/express@*(resolved as 4.17.2) but using ancestor(apollo-server-express)'s dependency @types/[email protected](resolved as 4.17.1)
deprecate @vue/[email protected] › [email protected] › [email protected] › [email protected] › [email protected] › core-js@^2.5.0 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.
Recently updated (since 2019-12-11): 44 packages (detail see file /usr/local/lib/node_modules/@vue/cli/node_modules/.recently_updates.txt)
Today:
→ [email protected] › @types/[email protected] › @types/node@*(12.12.20) (02:09:41)
→ resolve@^1.13.0(1.14.0) (08:27:21)
→ [email protected] › @babel/[email protected] › [email protected] › node-releases@^1.1.42(1.1.43) (06:41:59)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › [email protected] › @apollo/[email protected] › @types/node@^10.1.0(10.17.11) (02:10:44)
2019-12-17
→ @vue/[email protected] › [email protected] › apollo-server-express@^2.9.6(2.9.14) (20:24:09)
→ @vue/[email protected] › [email protected] › [email protected] › apollo-server-types@^0.2.9(0.2.9) (20:23:51)
→ @vue/[email protected] › [email protected] › [email protected] › apollo-server-core@^2.9.14(2.9.14) (20:24:06)
→ @vue/[email protected] › [email protected] › [email protected] › @types/[email protected] › @types/connect@*(3.4.33) (21:28:08)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › apollo-cache-control@^0.8.9(0.8.9) (20:24:01)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › apollo-server-plugin-base@^0.6.9(0.6.9) (20:23:56)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › graphql-extensions@^0.10.8(0.10.8) (20:23:56)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › apollo-tracing@^0.8.9(0.8.9) (20:24:01)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › apollo-engine-reporting@^1.4.12(1.4.12) (20:24:01)
2019-12-16
→ @vue/[email protected] › [email protected] › [email protected] › is-regex@^1.0.4(1.0.5) (07:58:16)
→ [email protected] › @babel/[email protected] › [email protected] › caniuse-lite@^1.0.30001015(1.0.30001016) (14:32:37)
2019-12-15
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › fast-json-stable-stringify@^2.0.0(2.1.0) (00:17:57)
→ [email protected] › nanoid@^2.1.0(2.1.8) (02:53:21)
2019-12-14
→ @vue/[email protected] › string.prototype.padstart@^3.0.0(3.1.0) (16:31:46)
→ [email protected] › flow-parser@0.*(0.114.0) (00:41:31)
→ [email protected] › vue-template-compiler@^2.5.13(2.6.11) (03:58:29)
→ @vue/[email protected] › [email protected] › [email protected] › apollo-utilities@^1.0.8(1.3.3) (19:44:20)
→ @vue/[email protected] › [email protected] › apollo-cache-inmemory@^1.6.3(1.6.5) (19:44:28)
→ @vue/[email protected] › [email protected] › [email protected] › graphql-anywhere@^4.1.0-alpha.0(4.2.6) (19:44:24)
→ @vue/[email protected] › [email protected] › apollo-client@^2.6.4(2.6.8) (19:55:32)
→ @vue/[email protected] › [email protected] › [email protected] › @oclif/[email protected] › @oclif/plugin-help@^2(2.2.3) (02:22:14)
→ @vue/[email protected] › [email protected] › [email protected] › apollo-cache@^1.3.4(1.3.4) (19:44:23)
→ @vue/[email protected] › [email protected] › [email protected] › @oclif/[email protected] › cli-ux@^5.2.1(5.4.1) (02:22:59)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › fsevents@^1.2.7(1.2.11) (19:28:18)
2019-12-13
→ [email protected] › @babel/[email protected] › @babel/[email protected] › @babel/[email protected] › [email protected] › regjsparser@^0.6.0(0.6.1) (13:55:05)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › [email protected] › [email protected] › object.getownpropertydescriptors@^2.0.3(2.1.0) (15:26:38)
2019-12-12
→ @vue/[email protected] › [email protected] › es-abstract@^1.17.0-next.1(1.17.0-next.1) (13:57:53)
→ vue-jscodeshift-adapter@^2.0.2(2.0.3) (05:26:04)
→ [email protected] › @babel/[email protected] › core-js-compat@^3.4.7(3.5.0) (08:59:54)
→ @vue/[email protected] › [email protected] › apollo@^2.20.0(2.21.2) (06:17:26)
→ @vue/[email protected] › [email protected] › [email protected] › @apollographql/apollo-tools@^0.4.2(0.4.2) (06:17:09)
→ @vue/[email protected] › [email protected] › [email protected] › apollo-codegen-core@^0.35.9(0.35.9) (06:17:16)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › apollo-language-server@^1.17.2(1.17.2) (06:17:12)
→ @vue/[email protected] › [email protected] › [email protected] › apollo-codegen-flow@^0.33.34(0.33.34) (06:17:20)
→ @vue/[email protected] › [email protected] › [email protected] › apollo-codegen-swift@^0.35.14(0.35.14) (06:17:20)
→ @vue/[email protected] › [email protected] › [email protected] › apollo-codegen-scala@^0.34.34(0.34.34) (06:17:20)
→ @vue/[email protected] › [email protected] › [email protected] › [email protected] › [email protected] › apollo-graphql@^0.3.4(0.3.6) (06:17:09)
→ @vue/[email protected] › [email protected] › [email protected] › @apollographql/[email protected] › [email protected] › core-js@^3.0.1(3.5.0) (08:58:51)
→ @vue/[email protected] › [email protected] › [email protected] › apollo-codegen-typescript@^0.35.9(0.35.9) (06:17:20)
2019-12-11
→ @vue/[email protected] › [email protected] › [email protected] › @oclif/[email protected] › yarn@^1.15.0(1.21.1) (17:40:56)
All packages installed (978 packages installed from npm registry, used 2m(network 2m), speed 374.01kB/s, json 861(2.12MB), tarball 33.45MB)
[@vue/[email protected]] link /usr/local/bin/vue@ -> /usr/local/lib/node_modules/@vue/cli/bin/vue.js
sudo npm install -g @vue/cli --unsafe-perm(最好使用npm)
MacBookPro:~ zhangxm$ sudo npm install -g @vue/cli --unsafe-perm
npm WARN deprecated [email protected]: 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.
/usr/local/bin/vue -> /usr/local/lib/node_modules/@vue/cli/bin/vue.js
> [email protected] install /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents
> node-gyp rebuild
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> [email protected] postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/babel-polyfill/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> [email protected] postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> [email protected] postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> @apollo/[email protected] postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/@apollo/protobufjs
> node scripts/postinstall
> [email protected] postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/nodemon
> node bin/postinstall || exit 0
> [email protected] postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/ejs
> node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
+ @vue/[email protected]
added 1150 packages from 636 contributors, removed 21 packages and updated 1 package in 74.818s
vue ui
MacBookPro:node_modules zhangxm$ vue --version
@vue/cli 4.1.1
MacBookPro:node_modules zhangxm$ vue ui
Starting GUI...
Ready on http://localhost:8000
配置淘宝node-sass
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/