npm运行dev作品,但观察编译和错误

时间:2019-02-06 19:55:36

标签: npm webpack

我有一个Laravel 5.6项目,它将无法运行npm run watch。它将编译文件,但在尝试查看文件时抛出错误。 npm run dev可以正常工作。 npm在版本6.7.0上。节点位于8.11.4上

这是我在终端中遇到的错误:

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

Error: watch node_modules/stompjs/lib/stomp.min.js ENOSPC
    at _errnoException (util.js:992:11)
    at FSWatcher.start (fs.js:1382:19)
    at Object.fs.watch (fs.js:1408:11)
    at createFsWatchInstance (/home/mana/Projects/neptune/inventory-management/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/mana/Projects/neptune/inventory-management/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/mana/Projects/neptune/inventory-management/node_modules/chokidar/lib/nodefs-handler.js:232:14)
    at FSWatcher.NodeFsHandler._handleFile (/home/mana/Projects/neptune/inventory-management/node_modules/chokidar/lib/nodefs-handler.js:259:21)
    at FSWatcher.<anonymous> (/home/mana/Projects/neptune/inventory-management/node_modules/chokidar/lib/nodefs-handler.js:488:21)
    at FSReqWrap.oncomplete (fs.js:153:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ development 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/mana/.npm/_logs/2019-02-06T19_41_09_031Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `npm run development -- --watch`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ watch 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/mana/.npm/_logs/2019-02-06T19_41_09_080Z-debug.log

该日志没有终端已经说过的内容。

这是package.json:

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "vue-test": "mocha-webpack --webpack-config webpack.config.js --require tests/Vue/setup.js tests/Vue/**/*.spec.js"
  },
  "devDependencies": {
    "@vue/test-utils": "^1.0.0-beta.13",
    "babel-eslint": "^8.2.3",
    "eslint": "^4.19.1",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-plugin-import": "^2.11.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.7.0",
    "eslint-plugin-vue": "^4.5.0",
    "expect": "^22.4.3",
    "gulp": "^3.8.8",
    "jsdom": "^11.7.0",
    "jsdom-global": "^3.0.2",
    "mocha": "^5.0.5",
    "mocha-webpack": "^1.1.0"
  },
  "dependencies": {
    "acorn": "^6.0.4",
    "ajv": "^6.6.2",
    "axios": "^0.18",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.1",
    "daterangepicker": "^3.0.3",
    "imagemin": "^5.3.1",
    "jquery": "^3.1.1",
    "laravel-elixir": "^4.0.0",
    "laravel-mix": "^2.0",
    "lodash": "^4.17.4",
    "moment": "^2.22.0",
    "node-sass": "^4.11.0",
    "npm": "^6.4.1",
    "popper.js": "^1.12",
    "stompjs": "^2.3.3",
    "tabulator-tables": "^4.0.5",
    "vue": "^2.5.7",
    "vue-resource": "^1.3.4",
    "vue-shortkey": "^3.1.6",
    "vuex": "^3.0.1"
  }
}

在有人建议之前,我已经删除了node_modules文件夹,清除了npm缓存,并运行了npm install大约10次。不起作用这就是每个人似乎对npm的建议。 :)

1 个答案:

答案 0 :(得分:0)

尝试以下步骤

<块引用>
  1. rm -rf node_modules 或者直接删除
  2. rm package-lock.json yarn.lock
  3. npm 缓存清除 --force
  4. npm 安装
  5. npm run dev