首页 > 解决方案 > React 应用程序未在浏览器中运行。如何解决这个问题?

问题描述

启动开发服务器...

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

Error: watch /home/test/Documents/test/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/test/Documents/test/node_modules/chokidar/lib/nodefs-handler.js:38:15)
        at setFsWatchListener (/home/test/Documents/test/node_modules/chokidar/lib/nodefs-handler.js:81:15)
        at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/oxss-006/Documents/test/node_modules/chokidar/lib/nodefs-handler.js:233:14)
        at FSWatcher.NodeFsHandler._handleDir (/home/test/Documents/test/node_modules/chokidar/lib/nodefs-handler.js:429:19)
        at FSWatcher.<anonymous> (/home/test/Documents/test/node_modules/chokidar/lib/nodefs-handler.js:477:19)
        at FSWatcher.<anonymous> (/home/test/Documents/test/node_modules/chokidar/lib/nodefs-handler.js:482:16)
        at FSReqWrap.oncomplete (fs.js:153:5)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the test@0.1.0 start 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/.npm/_logs/2019-09-23T04_38_51_220Z-debug.log

启动 npm 时出现错误。它没有在浏览器中运行。如何解决这个问题?如果有人知道请回答这个问题。

This site can’t be reachedlocalhost refused to connect.
Did you mean http://localhost3000.org/?
Search Google for localhost 3000
ERR_CONNECTION_REFUSED

我正在使用这些版本
node v -v8.10.0
npm - 6.11.3

谢谢。

标签: node.jsreactjsnpm

解决方案


回声 fs.inotify.max_user_watches=999999 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

您的手表结束了,手表用于在代码发生变化时重新加载应用程序。


推荐阅读