node.js - create-react-app 'npm start' 不起作用,即使是新建的应用程序。 chokidar Node 模块内部抛出的错误

标签 node.js npm create-react-app

在使用“create-react-app”新建的应用程序上使用“npm start test_app”时遇到此错误。这个问题也出现在我之前使用 create-react-app 创建的项目中。 我尝试将 Node 版本更新为 v8.9.1,将 npm 版本更新为 5.5.1。问题仍然存在。

test_app@0.1.0 start /home/user/test_app react-scripts start

Starting the development server...

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

Error: watch /home/user/test_app/public ENOSPC
    at exports._errnoException (util.js:1012:11)
    at FSWatcher.start (fs.js:1429:19)
    at Object.fs.watch (fs.js:1456:11)
    at createFsWatchInstance (/home/user/test_app/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/user/test_app/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/user/test_app/node_modules/chokidar/lib/nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleDir (/home/user/test_app/node_modules/chokidar/lib/nodefs-handler.js:407:19)
    at FSWatcher.<anonymous> (/home/user/test_app/node_modules/chokidar/lib/nodefs-handler.js:455:19)
    at FSWatcher.<anonymous> (/home/user/test_app/node_modules/chokidar/lib/nodefs-handler.js:460:16)
    at FSReqWrap.oncomplete (fs.js:123:15)

npm ERR! Linux 4.4.0-81-generic
npm ERR! argv "/usr/local/nodejs/bin/node" "/usr/local/nodejs/bin/npm" "start"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! test_app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the test_app@0.1.0 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the test_app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs test_app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls test_app
npm ERR! There is likely additional logging output above.

我在使用 create-react-app 创建应用程序后运行“npm install”时收到以下警告(这可能是相关的,因为抛出错误的 chokidar 是 fs.watch 的包装器):

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

最佳答案

答案是更新 Node 版本

nvm install lts/*

我遇到了同样的问题,自从上一个项目以来我一直在使用 Node 8(现在是 10),这是因为弃用问题,很遗憾,但是旧的 js 函数已被完全删除

enter image description here

关于node.js - create-react-app 'npm start' 不起作用,即使是新建的应用程序。 chokidar Node 模块内部抛出的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47647984/

相关文章:

javascript - module.exports 函数在另一个文件的 require 之后未定义

typescript - 是否可以让 Typescript 了解 package.json 中定义的依赖版本?

node.js - 无法使用 Windows 10 安装 firebase 工具 cli

javascript - 可选的链接运算符在本地主机上工作但不在生产中

javascript - 向图形魔术命令添加 if 条件

node.js - 来自远程 url 的 koa.js 流响应

javascript - Node.js http.request options 主机名参数的正确格式是什么?

javascript - 如果您只是从 npm 下载它,为什么要将 node_modules 包含在 .gitignore 文件中?

css - 在 create-react-app 中生成 RTL CSS 文件并根据状态变化在它们之间切换

reactjs - yarn 开始 : Could not find or load main class start