最近在学vue
准备利用官方的脚手架先搭建环境然后写一个小demo,结果各种不顺利
$ npm install vue-cli -g # 顺利完成
$ vue init webpack vue-demo #顺利
$ cd vue-demo/
$ npm install # 遇到问题了
$ npm run dev # 遇到问题了
npm install 遇到问题 - 解决办法
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "E:\Program Files\nodejs\node.exe" "E:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v4.4.1
npm ERR! npm v2.14.20
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package eslint-plugin-promise@2.0.1 does not satisfy its siblings' peerDependencies requirements!npm ERR! peerinvalid Peer eslint-config-standard@6.2.1 wants eslint-plugin-promise@>=3.3.0
npm ERR! Please include the following file with any support request:npm ERR! E:MySoftwaretestGitwebpackvue-projectnpm-debug.log
解决办法
node版本低,下载高版本
卸载以前node版本,下载新版本重新安装
使用 npm install -g n 可以更新node 但是很悲剧,我的报错
npm run dev # 遇到问题- 解决办法
vue-project@1.0.0 dev E:MySoftwaretestGitwebpackvue-projectnode build/dev-server.js "8088"
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EACCES 0.0.0.0:8080
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at Server._listen2 (net.js:1244:19)
at listen (net.js:1293:10)
at Server.listen (net.js:1389:5)
at EventEmitter.listen (E:\MySoftware\testGit\webpack\vue-project\node_modules\express\lib\application.js:617:24)
at Object.<anonymous> (E:\MySoftware\testGit\webpack\vue-project\build\dev-server.js:62:22)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
$ npm dev run --port 1314 # 不行啊,,报错 疯了
网上找很多帖子,都没有写解决办法,自己来喽,也是神奇的错误
最后,神奇的是,错误居然被哦改好了
解决办法
进入 vue-demo/config/index.js
dev: {
env: require('./dev.env'),
port: 8088, # 注意了啊。。。修改成你要的端口,接着运行代码就看到效果了
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
// (https://github.com/webpack/css-loader#sourcemaps)
// In our experience, they generally work as expected,
// just be aware of this issue when enabling this option.
cssSourceMap: false
}
$ npm run dev --port 8088 # ok 访问http://localhost:8088/查看结果
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。