安裝淘寶鏡像 $ npm:npm install -g cnpm --registry=https://registry.npm.taobao.org # 升級 npm $ cnpm install npm -g
$ cnpm install vue
1)# 全局安裝 vue-cli $ cnpm install --global vue-cli 2)# 下載webpack離線安裝包 $ https://github.com/vuejs-templates/webpack.git 3)# 在用戶目錄下查看是否有.vue-templates目錄,沒有的,則創建 # (文件名命名:文件名之后加點 即.vue-templates.回車就是需要的) # 命令行:cd users/HP(其中HP是電腦用戶名,根據實際情況選擇);makir .vue-templates 4)# 離線模板創建項目: $ vue init webpack my-project --offline # 這里需要進行一些配置,默認回車即可 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 <test@runoob.com> ? 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:8081