在新vue项目上运行npm run serve时出错

时间:2019-12-15 15:26:26

标签: javascript vue.js npm frontend vue-cli

我做到了:

vue create myfirstapp 
atom (for open my editor)
cd myfirst app
npm run serve 

我明白了

> myfirstapp@0.1.0 serve /home/paolinsky/Documentos/vueBasico/fazt/myfirstapp
> vue-cli-service serve

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

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/public'
    at FSWatcher.<computed> (internal/fs/watchers.js:168:26)
    at Object.watch (fs.js:1351:34)
    at createFsWatchInstance (/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/node_modules/chokidar/lib/nodefs-handler.js:38:15)
    at setFsWatchListener (/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/node_modules/chokidar/lib/nodefs-handler.js:81:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/node_modules/chokidar/lib/nodefs-handler.js:233:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/node_modules/chokidar/lib/nodefs-handler.js:429:19)
    at FSWatcher.<anonymous> (/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/node_modules/chokidar/lib/nodefs-handler.js:477:19)
    at FSWatcher.<anonymous> (/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/node_modules/chokidar/lib/nodefs-handler.js:482:16)
    at FSReqCallback.oncomplete (fs.js:165:5)
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/node_modules/chokidar/index.js:260:10)
    at createFsWatchInstance (/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/node_modules/chokidar/lib/nodefs-handler.js:40:5)
    at setFsWatchListener (/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/node_modules/chokidar/lib/nodefs-handler.js:81:15)
    [... lines matching original stack trace ...]
    at FSReqCallback.oncomplete (fs.js:165:5) {
  errno: -28,
  syscall: 'watch',
  code: 'ENOSPC',
  path: '/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/public',
  filename: '/home/paolinsky/Documentos/vueBasico/fazt/myfirstapp/public'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myfirstapp@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the myfirstapp@0.1.0 serve 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/paolinsky/.npm/_logs/2019-12-15T15_13_50_223Z-debug.log

这总是发生在我所有的vue项目中,包括新项目。

我的版本是: npm:6.13.4 节点:v13.3.0

我在华硕vivobook笔记本电脑上运行Ubuntu 18.04 4GB ram,英特尔酷睿I3第七代

1 个答案:

答案 0 :(得分:0)

我最近也遇到了同样的问题。我是这样解决的:

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

cat /proc/sys/fs/inotify/max_user_watches

fs.inotify.max_user_watches=524288