VuePress未在开发服务器中运行

时间:2018-05-30 06:15:32

标签: javascript webpack vue.js webpack-dev-server vuepress

我在本地克隆了一个来自github的repo,它是一个与VuePress相关的代码。在package.json文件中,它只有以下脚本。

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

但是我想在我的本地浏览器中运行它,所以我添加了一个开发脚本,如下所示

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

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

显示以下错误

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! vuepress-base@1.0.0 dev: `vuepress dev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vuepress-base@1.0.0 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

通过运行 vuepress build 生成静态文件,但我想在8080端口中运行它。有人请帮帮我。

1 个答案:

答案 0 :(得分:1)

当我们超过通知查看器的限制时,就会发生这种情况。以下命令可解决此问题:

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