我使用React v15.6.1和Yarn,试图从终端启动react app,但是当我执行命令“ yarn start”时抛出错误,没有运行该应用
日志:纱线开始
Starting the development server...
events.js:183
throw er; // Unhandled 'error' event
^
Error: watch /home/navastud/atom-workspace/intervijs/public ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)
at createFsWatchInstance (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:153:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
所以我尝试执行命令'npm install',但是没有指出其他错误。
日志:npm install
multicomp@0.1.0 /home/navastud/atom-workspace/intervijs
├─┬ eslint@5.2.0
│ ├── chalk@2.4.1
│ ├─┬ inquirer@5.2.0
│ │ └─┬ string-width@2.1.1
│ │ └─┬ strip-ansi@4.0.0
│ │ └── ansi-regex@3.0.0
│ ├─┬ js-yaml@3.12.0
│ │ └── esprima@4.0.1
│ ├─┬ strip-ansi@4.0.0
│ │ └── ansi-regex@3.0.0
│ └─┬ table@4.0.3
│ ├── UNMET PEER DEPENDENCY ajv@6.5.2
│ └── chalk@2.4.1
├─┬ eslint-config-equimper@2.2.2
│ ├─┬ babel-eslint@8.2.6
│ │ └─┬ @babel/code-frame@7.0.0-beta.44
│ │ └─┬ @babel/highlight@7.0.0-beta.44
│ │ └── chalk@2.4.1
│ ├─┬ UNMET PEER DEPENDENCY eslint@4.19.1
│ │ ├── chalk@2.4.1
│ │ ├─┬ espree@3.5.4
│ │ │ └─┬ acorn-jsx@3.0.1
│ │ │ └── acorn@3.3.0
│ │ ├── ignore@3.3.10
│ │ ├─┬ inquirer@3.3.0
│ │ │ ├── chalk@2.4.1
│ │ │ └─┬ strip-ansi@4.0.0
│ │ │ └── ansi-regex@3.0.0
│ │ ├─┬ js-yaml@3.12.0
│ │ │ └── esprima@4.0.1
│ │ └─┬ strip-ansi@4.0.0
│ │ └── ansi-regex@3.0.0
│ └─┬ eslint-plugin-class-property@1.1.0
│ └─┬ eslint@3.19.0
│ ├─┬ espree@3.5.4
│ │ └─┬ acorn-jsx@3.0.1
│ │ └── acorn@3.3.0
│ ├── ignore@3.3.10
│ └─┬ table@3.8.3
│ └─┬ string-width@2.1.1
│ └─┬ strip-ansi@4.0.0
│ └── ansi-regex@3.0.0
├── UNMET PEER DEPENDENCY react@15.6.2
├── UNMET PEER DEPENDENCY react-dom@15.6.2
└─┬ react-scripts@1.1.4
├─┬ autoprefixer@7.1.6
│ └─┬ postcss@6.0.23
│ └── chalk@2.4.1
├─┬ UNMET PEER DEPENDENCY eslint@4.10.0
│ ├── chalk@2.4.1
│ ├── eslint-scope@3.7.3
│ ├─┬ espree@3.5.4
│ │ └─┬ acorn-jsx@3.0.1
│ │ └── acorn@3.3.0
│ ├── ignore@3.3.10
│ ├─┬ js-yaml@3.12.0
│ │ └── esprima@4.0.1
│ └─┬ strip-ansi@4.0.0
│ └── ansi-regex@3.0.0
└─┬ sw-precache-webpack-plugin@0.11.4
└─┬ sw-precache@5.2.1
└─┬ update-notifier@2.5.0
├─┬ boxen@1.3.0
│ └── chalk@2.4.1
└── chalk@2.4.1
npm WARN optional Skipping failed optional dependency /react-scripts /fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.4
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.4
npm WARN optional Skipping failed optional dependency /webpack-dev-server/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.4
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none was installed.
npm WARN eslint-config-react-app@2.1.0 requires a peer of eslint@^4.1.1 but none was installed.
npm WARN eslint-loader@1.9.0 requires a peer of eslint@>=1.6.0 <5.0.0 but none was installed.
npm WARN eslint-plugin-import@2.8.0 requires a peer of eslint@2.x - 4.x but none was installed.
npm WARN eslint-plugin-jsx-a11y@5.1.1 requires a peer of eslint@^2.10.2 || ^3 || ^4 but none was installed.
npm WARN eslint-plugin-react@7.4.0 requires a peer of eslint@^3.0.0 || ^4.0.0 but none was installed.
npm WARN react-d3-speedometer@0.3.2 requires a peer of react@^0.14.7 || ^16.0.0 but none was installed.
npm WARN react-svg-gauge@1.0.8 requires a peer of react@^16.2.0 but none was installed.
npm WARN react-svg-gauge@1.0.8 requires a peer of react-dom@^16.2.0 but none was installed.
为什么会发生这种情况以及如何解决?
答案 0 :(得分:3)
很难确切地说出出现此错误的原因,但是如果删除node_modules
目录并重新安装每个依赖项,它将按预期工作。
rm -rf ./node_modules && npm install
答案 1 :(得分:-1)
可以使用以下命令:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p