Search code examples
javascriptwebpackvue.jswebpack-dev-servervuepress

VuePress is not running in dev server


I have cloned a repo from github locally and it is a VuePress related code. In the package.json file it only have this following scripts.

"scripts": {
    "build": "vuepress build",
    "test": "rm -rf .vuepress/dist && npm run build && stat .vuepress/dist/index.html"
  },

But I want to run it in my local browser so I added a dev script as follows

  "scripts": {
    "build": "vuepress build",
    "dev"  : "vuepress dev",

    "test": "rm -rf .vuepress/dist && npm run build && stat .vuepress/dist/index.html"
  },

It showed the following error

node_modules/core-js/modules/es6.array.for-each.js

events.js:137
      throw er; // Unhandled 'error' event
      ^

Error: watch /media/itsd/ITSD/vuepress-base/node_modules/npm/doc/cli/npm-completion.md ENOSPC
    at _errnoException (util.js:1003:13)
    at FSWatcher.start (fs.js:1397:19)
    at Object.fs.watch (fs.js:1423:11)
    at createFsWatchInstance (/media/itsd/ITSD/vuepress-base/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/media/itsd/ITSD/vuepress-base/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/media/itsd/ITSD/vuepress-base/node_modules/chokidar/lib/nodefs-handler.js:229:14)
    at FSWatcher.NodeFsHandler._handleFile (/media/itsd/ITSD/vuepress-base/node_modules/chokidar/lib/nodefs-handler.js:256:21)
    at FSWatcher.<anonymous> (/media/itsd/ITSD/vuepress-base/node_modules/chokidar/lib/nodefs-handler.js:474:21)
    at FSReqWrap.oncomplete (fs.js:167:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `vuepress dev`
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/itsd/.npm/_logs/2018-05-30T05_06_55_941Z-debug.log

by running vuepress build the static files are generated but I want to run it in my 8080 port. Anyone please help me with this.


Solution

  • This happens when we cross the limit for the notifications watcher. following command fixes the issue :

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