最近在學習vue.js,寫下筆記
一、安裝npm及cnpm
1、安裝node
https://nodejs.org/dist/latest/
選擇:node-v13.3.0-x64.msi
會繼續安裝必要工具
把node.exe所在目錄加入path環境變量中
>node --version
(v13.3.0)
2、安裝git
(略過)
>git --version
(git version 2.18.0.windows.1)
3、安裝npm
>d:
>cd vue
>git config --system http.sslcainfo/bin/curl-ca-bundle.crt
>git clone --recursive git://github.com/isaacs/npm.git
>cd npm
>npm --version
4、安裝cnpm
>cd ..
>npm install -g cnpm --registry=https://registry.npm.taobao.org
二、使用VueCli快速構建項目
>cnpm install vue-cli -g
>vue --version
創建項目:
>d:
>cd vue\project
>vue init webpack new01
(配置如下)
>cd new01
>cnpm install
>npm start
在瀏覽器輸入:http://localhost:8080 訪問
然後在另一個控制檯,輸入
>d:
>cd vue\project\new01
>npm run build
這樣就創建了一個HelloWorld項目