安裝Vue腳手架的時候javascript
指令:npm install vue-cli -gvue
Microsoft Windows [版本 6.1.7601] 版權全部 (c) 2009 Microsoft Corporation。保留全部權利。 C:\Users\Administrator>npm install vue-cli -g npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coff eescript" (no hyphen) C:\Users\Administrator\AppData\Roaming\npm\vue -> C:\Users\Administrator\AppData \Roaming\npm\node_modules\vue-cli\bin\vue C:\Users\Administrator\AppData\Roaming\npm\vue-init -> C:\Users\Administrator\Ap pData\Roaming\npm\node_modules\vue-cli\bin\vue-init C:\Users\Administrator\AppData\Roaming\npm\vue-list -> C:\Users\Administrator\Ap pData\Roaming\npm\node_modules\vue-cli\bin\vue-list + vue-cli@2.9.6 added 4 packages from 1 contributor, removed 389 packages and updated 235 packag es in 251.71s C:\Users\Administrator>
報了一個警告:以下java
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)node
解決辦法(說明):coffee-script 這個依賴包xx的更名了,不影響你使用的,還有coffee-script已通過氣了:)webpack
初始化Vue項目的時候git
vue init webpack test-2vlftgithub
G:\sinoyd\personalProject>vue init webpack test-2vlft ? Project name test-2vlft ? Project description A Vue.js project ? Author xichaoqun <1593760568@qq.com> ? Vue build (Use arrow keys) ? Vue build standalone ? Install vue-router? Yes ? Use ESLint to lint your code? No ? Set up unit tests No ? Setup e2e tests with Nightwatch? No ? Should we run `npm install` for you after the project has been created? (recom ? Should we run `npm install` for you after the project has been created? (recom mended) npm vue-cli · Generated "test-2vlft". # Installing project dependencies ... # ======================== npm WARN deprecated bfj-node4@5.3.1: Switch to the `bfj` package for fixes and n ew features! npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Br owserslist >3.0 config used in other tools. npm ERR! Unexpected end of JSON input while parsing near '...1PMB+NX2XCrirPUJC2m A6' npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-04-20T0 5_10_15_943Z-debug.log # Project initialization finished! # ======================== To get started: cd test-2vlft npm run dev Documentation can be found at https://vuejs-templates.github.io/webpack
警告+錯誤:web
npm WARN deprecated bfj-node4@5.3.1: Switch to the `bfj` package for fixes and new features! npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm ERR! Unexpected end of JSON input while parsing near '...1PMB+NX2XCrirPUJC2mA6' npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-04-20T05_10_15_943Z-debug.log
解決辦法:
解決辦法: cnpm install (在安裝淘寶鏡像的前提下 npm install -g cnpm --registry=https://registry.npm.taobao.org cmd切入項目的所在目錄,執行cnpm install) 例子: G:\sinoyd\personalProject\test-2vlft>cnpm install
安裝Vue腳手架的時候
Vue項目打包
首先要 cnpm 下載 webpack cmd 執行如下命令 cnpm install webpack -g cnpm install webpack-cli -g
最後輸入 webpack -v 彈出版本 表示安裝成功vue-router
cmd 輸入 cnpm install webpack -g 會報錯 :vue-cli
[fsevents@^1.2.7] optional install error: Package require os(darwin) not compati
ble with your platform(win32)
大體意思:這是一個能夠忽略的錯誤,fsevents是可選的依賴,只能應用於maxOS系統,不適合Windows或者Linux,也就是忽略便可。
打包過程:先中止該Vue項目,cmd 輸入 npm run build 等待,即打包完成