vue-problems

vue项目在使用过程中的问题:


通过一下午的摸索啊,终于得到了一定的成绩

1、nodejs 、npm 、Git的安装


2、建议先安装bower(包管理器)

1
$npm install bower -g

3、使用bower:如安装vue#1.0.28

a:查看bower的版本
1
$ bower --version
b:查看vue的版本
1
$ bower info vue
c:选择要下载最新的稳定版本如vue#1.0.28
1
$ bower install vue#1.0.28
下载成功之后可以看到bower_components文件夹,在需要引入vue的时候,可以这样通过下面的这个路径引入:到项目中
1
<script src="bower_components/vue/dist/vue.js"></script>

4(1)、vue全局安装

1
$ npm install -g vue-cli

4(2)、vue开发版本的安装

1
2
3
4
$ git clone https://github.com/vuejs/vue.git node_modules/vue
$ cd node_modules/vue
$ npm install
$ npm run build

5、如克隆项目:https://github.com/PanJiaChen/vue-element-admin.git

a: 克隆项目
1
$ git clone https://github.com/PanJiaChen/vue-element-admin.git
b: 安装依赖
1
$ npm install
建议不要用cnpm 安装有各种诡异的bug 可以通过如下操作解决npm速度慢的问题
1
$ npm install --registry=https://registry.npm.taobao.org
c:本地开发 开启服务
1
$ npm run dev


重要的来了,在我运行这个项目的时候,前面的克隆没有发现问题

1、但是当运行到安装依赖的时候就开始报错了:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
...(已省略)
gyp ERR! configure error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack at exports._errnoException (util.js:746:11)
gyp ERR! stack at TCP.onread (net.js:559:26)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\master\\AppDa
ta\\Roaming\\npm\\node_modules\\ionic\\node_modules\\ionic-app-lib\\node_modules
\\node-sass\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--
libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\master\AppData\Roaming\npm\node_modules\ionic\node_modules
\ionic-app-lib\node_modules\node-sass
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v3.1.0
gyp ERR! not ok
Build failed
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {
"node":"0.12.7","npm":"2.11.3"})
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ionic"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! node-sass@3.4.2 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.4.2 postinstall script 'node scripts/build.js
'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\master\npm-debug.log

对于这个问题的解决办法是参见这个:解决atom无法安装package的问题

2、Windows下运行的时候,注意项目下的node_modules中的node-sass不能删掉,package.json也不能删掉的,否则在运行

1
$ npm run dev

将会出错。