vue-cli脚手架的安装
发布日期:2021-05-09 04:59:18 浏览次数:17 分类:博客文章

本文共 8052 字,大约阅读时间需要 26 分钟。

命令行安装

环境依赖:

  • 必须安装node
  • 验证node是否安装
node -vnpm -v

对应显示版本号即可,如下图:

 

 

 

全局安装vue-cli

npm install --global vue-cli

如安装过程中安装较慢或较慢,使用手机4G热点安装,亲测好用。

安装成功如下:

C:\Users\Administrator>npm install --global vue-clinpm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour @vue/clinpm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "ceescript" (no hyphen)C:\Users\Administrator\AppData\Roaming\npm\vue -> C:\Users\Administrator\AppD\Roaming\npm\node_modules\vue-cli\bin\vueC:\Users\Administrator\AppData\Roaming\npm\vue-list -> C:\Users\AdministratorpData\Roaming\npm\node_modules\vue-cli\bin\vue-listC:\Users\Administrator\AppData\Roaming\npm\vue-init -> C:\Users\AdministratorpData\Roaming\npm\node_modules\vue-cli\bin\vue-initC:\Users\Administrator\AppData\Roaming\npm`-- vue-cli@2.9.6  +-- async@2.6.3  | `-- lodash@4.17.15  +-- chalk@2.4.2  | +-- ansi-styles@3.2.1  | | `-- color-convert@1.9.3  | |   `-- color-name@1.1.3  | +-- escape-string-regexp@1.0.5  | `-- supports-color@5.5.0  |   `-- has-flag@3.0.0  +-- coffee-script@1.12.7  +-- commander@2.20.3  +-- consolidate@0.14.5  | `-- bluebird@3.7.2  +-- download-git-repo@1.1.0  | +-- download@5.0.3  | | +-- caw@2.0.1  | | | +-- get-proxy@2.1.0  | | | | `-- npm-conf@1.1.3  | | | |   +-- config-chain@1.1.12  | | | |   | +-- ini@1.3.5  | | | |   | `-- proto-list@1.2.4  | | | |   `-- pify@3.0.0  | | | +-- isurl@1.0.0  | | | | +-- has-to-string-tag-x@1.4.1  | | | | | `-- has-symbol-support-x@1.4.2  | | | | `-- is-object@1.0.1  | | | `-- url-to-options@1.0.1  | | +-- decompress@4.2.0  | | | +-- decompress-tar@4.1.1  | | | | +-- file-type@5.2.0  | | | | `-- tar-stream@1.6.2  | | | |   +-- bl@1.2.2  | | | |   +-- buffer-alloc@1.2.0  | | | |   | +-- buffer-alloc-unsafe@1.1.0  | | | |   | `-- buffer-fill@1.0.0  | | | |   +-- end-of-stream@1.4.4  | | | |   +-- fs-constants@1.0.0  | | | |   +-- readable-stream@2.3.6  | | | |   | +-- isarray@1.0.0  | | | |   | +-- process-nextick-args@2.0.1  | | | |   | +-- safe-buffer@5.1.2  | | | |   | +-- string_decoder@1.1.1  | | | |   | | `-- safe-buffer@5.1.2  | | | |   | `-- util-deprecate@1.0.2  | | | |   +-- to-buffer@1.1.1  | | | |   `-- xtend@4.0.2  | | | +-- decompress-tarbz2@4.1.1  | | | | +-- file-type@6.2.0  | | | | +-- seek-bzip@1.0.5  | | | | | `-- commander@2.8.1  | | | | |   `-- graceful-readlink@1.0.1  | | | | `-- unbzip2-stream@1.3.3  | | | |   `-- buffer@5.4.3  | | | |     +-- base64-js@1.3.1  | | | |     `-- ieee754@1.1.13  | | | +-- decompress-targz@4.1.1  | | | +-- decompress-unzip@4.0.1  | | | | +-- file-type@3.9.0  | | | | +-- get-stream@2.3.1  | | | | | +-- object-assign@4.1.1  | | | | | `-- pinkie-promise@2.0.1  | | | | |   `-- pinkie@2.0.4  | | | | `-- yauzl@2.10.0  | | | |   +-- buffer-crc32@0.2.13  | | | |   `-- fd-slicer@1.1.0  | | | |     `-- pend@1.2.0  | | | +-- graceful-fs@4.2.3  | | | +-- make-dir@1.3.0  | | | | `-- pify@3.0.0  | | | `-- strip-dirs@2.1.0  | | |   `-- is-natural-number@4.0.1  | | +-- filenamify@2.1.0  | | | +-- filename-reserved-regex@2.0.0  | | | +-- strip-outer@1.0.1  | | | `-- trim-repeated@1.0.0  | | +-- get-stream@3.0.0  | | +-- got@6.7.1  | | | +-- create-error-class@3.0.2  | | | | `-- capture-stack-trace@1.0.1  | | | +-- duplexer3@0.1.4  | | | +-- is-redirect@1.0.0  | | | +-- is-retry-allowed@1.2.0  | | | +-- is-stream@1.1.0  | | | +-- lowercase-keys@1.0.1  | | | +-- timed-out@4.0.1  | | | +-- unzip-response@2.0.1  | | | `-- url-parse-lax@1.0.0  | | |   `-- prepend-http@1.0.4  | | +-- mkdirp@0.5.1  | | `-- pify@2.3.0  | `-- git-clone@0.1.0  +-- handlebars@4.5.3  | +-- neo-async@2.6.1  | +-- optimist@0.6.1  | | +-- minimist@0.0.8  | | `-- wordwrap@0.0.3  | +-- source-map@0.6.1  | `-- uglify-js@3.7.2  +-- inquirer@6.5.2  | +-- ansi-escapes@3.2.0  | +-- cli-cursor@2.1.0  | | `-- restore-cursor@2.0.0  | |   +-- onetime@2.0.1  | |   | `-- mimic-fn@1.2.0  | |   `-- signal-exit@3.0.2  | +-- cli-width@2.2.0  | +-- external-editor@3.1.0  | | +-- chardet@0.7.0  | | +-- iconv-lite@0.4.24  | | | `-- safer-buffer@2.1.2  | | `-- tmp@0.0.33  | |   `-- os-tmpdir@1.0.2  | +-- figures@2.0.0  | +-- mute-stream@0.0.7  | +-- run-async@2.3.0  | | `-- is-promise@2.1.0  | +-- rxjs@6.5.3  | | `-- tslib@1.10.0  | +-- string-width@2.1.1  | | +-- is-fullwidth-code-point@2.0.0  | | `-- strip-ansi@4.0.0  | |   `-- ansi-regex@3.0.0  | +-- strip-ansi@5.2.0  | | `-- ansi-regex@4.1.0  | `-- through@2.3.8  +-- metalsmith@2.3.0  | +-- absolute@0.0.1  | +-- chalk@1.1.3  | | +-- ansi-styles@2.2.1  | | +-- has-ansi@2.0.0  | | | `-- ansi-regex@2.1.1  | | +-- strip-ansi@3.0.1  | | | `-- ansi-regex@2.1.1  | | `-- supports-color@2.0.0  | +-- clone@1.0.4  | +-- co-fs-extra@1.2.1  | | +-- co-from-stream@0.0.0  | | | `-- co-read@0.0.1  | | +-- fs-extra@0.26.7  | | | +-- jsonfile@2.4.0  | | | `-- klaw@1.3.1  | | `-- thunkify-wrap@1.0.4  | |   `-- enable@1.3.2  | +-- gray-matter@2.1.1  | | +-- ansi-red@0.1.1  | | | `-- ansi-wrap@0.1.0  | | +-- extend-shallow@2.0.1  | | | `-- is-extendable@0.1.1  | | +-- js-yaml@3.13.1  | | | +-- argparse@1.0.10  | | | | `-- sprintf-js@1.0.3  | | | `-- esprima@4.0.1  | | `-- toml@2.3.6  | +-- has-generators@1.0.1  | +-- is@3.3.0  | +-- is-utf8@0.2.1  | +-- recursive-readdir@2.2.2  | +-- stat-mode@0.2.2  | +-- thunkify@2.1.2  | +-- unyield@0.0.1  | | `-- co@3.1.0  | +-- ware@1.3.0  | | `-- wrap-fn@0.1.5  | `-- win-fork@1.1.1  +-- minimatch@3.0.4  | `-- brace-expansion@1.1.11  |   +-- balanced-match@1.0.0  |   `-- concat-map@0.0.1  +-- multimatch@2.1.0  | +-- array-differ@1.0.0  | +-- array-union@1.0.2  | | `-- array-uniq@1.0.3  | `-- arrify@1.0.1  +-- ora@1.4.0  | +-- cli-spinners@1.3.1  | `-- log-symbols@2.2.0  +-- read-metadata@1.0.0  | `-- yaml-js@0.0.8  +-- request@2.88.0  | +-- aws-sign2@0.7.0  | +-- aws4@1.9.0  | +-- caseless@0.12.0  | +-- combined-stream@1.0.8  | | `-- delayed-stream@1.0.0  | +-- extend@3.0.2  | +-- forever-agent@0.6.1  | +-- form-data@2.3.3  | | `-- asynckit@0.4.0  | +-- har-validator@5.1.3  | | +-- ajv@6.10.2  | | | +-- fast-deep-equal@2.0.1  | | | +-- fast-json-stable-stringify@2.1.0  | | | +-- json-schema-traverse@0.4.1  | | | `-- uri-js@4.2.2  | | |   `-- punycode@2.1.1  | | `-- har-schema@2.0.0  | +-- http-signature@1.2.0  | | +-- assert-plus@1.0.0  | | +-- jsprim@1.4.1  | | | +-- extsprintf@1.3.0  | | | +-- json-schema@0.2.3  | | | `-- verror@1.10.0  | | |   `-- core-util-is@1.0.2  | | `-- sshpk@1.16.1  | |   +-- asn1@0.2.4  | |   +-- bcrypt-pbkdf@1.0.2  | |   +-- dashdash@1.14.1  | |   +-- ecc-jsbn@0.1.2  | |   +-- getpass@0.1.7  | |   +-- jsbn@0.1.1  | |   `-- tweetnacl@0.14.5  | +-- is-typedarray@1.0.0  | +-- isstream@0.1.2  | +-- json-stringify-safe@5.0.1  | +-- mime-types@2.1.25  | | `-- mime-db@1.42.0  | +-- oauth-sign@0.9.0  | +-- performance-now@2.1.0  | +-- qs@6.5.2  | +-- safe-buffer@5.2.0  | +-- tough-cookie@2.4.3  | | +-- psl@1.6.0  | | `-- punycode@1.4.1  | +-- tunnel-agent@0.6.0  | `-- uuid@3.3.3  +-- rimraf@2.7.1  | `-- glob@7.1.6  |   +-- fs.realpath@1.0.0  |   +-- inflight@1.0.6  |   | `-- wrappy@1.0.2  |   +-- inherits@2.0.4  |   +-- once@1.4.0  |   `-- path-is-absolute@1.0.1  +-- semver@5.7.1  +-- tildify@1.2.0  | `-- os-homedir@1.0.2  +-- uid@0.0.2  +-- user-home@2.0.0  `-- validate-npm-package-name@3.0.0    `-- builtins@1.0.3

创建一个基于 webpack 模板的新项目

# 创建一个基于 webpack 模板的新项目$ vue init webpack my-project# 这里需要进行一些配置,默认回车即可This will install Vue 2.x version of the template.For Vue 1.x use: vue init webpack#1.0 my-project? Project name my-project? Project description A Vue.js project? Author runoob 
? Vue build standalone? Use ESLint to lint your code? Yes? Pick an ESLint preset Standard? Setup unit tests with Karma + Mocha? Yes? Setup e2e tests with Nightwatch? Yes vue-cli · Generated "my-project". To get started: cd my-project npm install npm run dev Documentation can be found at https://vuejs-templates.github.io/webpack

进入项目,安装并运行:

$ cd my-project$ cnpm install$ cnpm run dev DONE  Compiled successfully in 4388ms> Listening at http://localhost:8080

成功执行以上命令后访问 http://localhost:8080/,输出结果如下所示:

 

上一篇:使用vue-cli编写todolist组件
下一篇:KALI LINUX 2.0 2019 更新国内源

发表评论

最新留言

路过,博主的博客真漂亮。。
[***.116.15.85]2025年04月20日 13时38分23秒