vue npm run dev启动报错

> [email protected] dev /home/haibin/WebstormProjects/vueProject/tabbar
> vue-cli-service serve

 INFO  Starting development server...
10% building 2/2 modules 0 activeevents.js:174
      throw er; // Unhandled 'error' event
      ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/haibin/WebstormProjects/vueProject/tabbar/public'
    at FSWatcher.start (internal/fs/watchers.js:165:26)
    at Object.watch (fs.js:1258:11)
    at createFsWatchInstance (/home/haibin/WebstormProjects/vueProject/tabbar/node_modules/chokidar/lib/nodefs-handler.js:38:15)
    at setFsWatchListener (/home/haibin/WebstormProjects/vueProject/tabbar/node_modules/chokidar/lib/nodefs-handler.js:81:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/haibin/WebstormProjects/vueProject/tabbar/node_modules/chokidar/lib/nodefs-handler.js:233:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/haibin/WebstormProjects/vueProject/tabbar/node_modules/chokidar/lib/nodefs-handler.js:429:19)
    at FSWatcher.<anonymous> (/home/haibin/WebstormProjects/vueProject/tabbar/node_modules/chokidar/lib/nodefs-handler.js:477:19)
    at FSWatcher.<anonymous> (/home/haibin/WebstormProjects/vueProject/tabbar/node_modules/chokidar/lib/nodefs-handler.js:482:16)
    at FSReqWrap.oncomplete (fs.js:154:5)
Emitted 'error' event at:
    at FSWatcher._handleError (/home/haibin/WebstormProjects/vueProject/tabbar/node_modules/chokidar/index.js:260:10)
    at createFsWatchInstance (/home/haibin/WebstormProjects/vueProject/tabbar/node_modules/chokidar/lib/nodefs-handler.js:40:5)
    at setFsWatchListener (/home/haibin/WebstormProjects/vueProject/tabbar/node_modules/chokidar/lib/nodefs-handler.js:81:15)
    [... lines matching original stack trace ...]
    at FSReqWrap.oncomplete (fs.js:154:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/haibin/.npm/_logs/2019-10-28T12_07_46_419Z-debug.log

1.删除node_modules

npm install

2.关闭编辑器,从新打开项目再重新

npm run dev

https://www.jianshu.com/p/4d2edd55b471
原来是我系统的原因我使用的是deepin系统根据上文修改后已经解决
即在终端输入

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
sudo sysctl --system

如果报错不是这种

可以查看package.json的scripts启动条件是dev还是serve在这里插入图片描述

你可能感兴趣的:(学习资料)