node.js - TypeError: fsevents is not a constructor(已经试过一堆答案)
问题描述
我正在关注 Maximilian Schwarzmüller 的反应教程 (udemy)
sudo npm install create-react-app -g
然后:
create-react-app react-complete-guide --scripts-version 1.1.5
一切都很好(毫无疑问,有一些警告)
然后,我 cd 进入文件夹npm start
首先我得到了这个错误: sh: react-scripts: command not found
从这个链接的建议:https ://github.com/facebook/create-react-app/issues/6594
我试过了:PATH=$PATH:./node_modules/.bin npm start
它可以启动一个浏览器并且它工作!
但这里是事情开始变得糟糕的时候:
在线程中,同一个人建议:Install the package in the global npm install -g react-scripts
或yarn global react-scripts
。然后,它可以在不设置环境的情况下执行(PATH=$PATH:...)。
所以我做了 npm install -g react-scripts
我开始收到错误:
TypeError: fsevents is not a constructor
我所知道的是这个错误应该很常见。我已经尝试了我遇到的所有解决方案:安装 yarn npm uninstall -g create-react-app
,然后npx create-react-app my-app
. 我也试过
npm audit fix --force
和npm i fsevents
但没有任何效果。它仍然向我展示了相同的TypeError: fsevents is not a constructor
我觉得我可能搞砸了我的终端。我可能拔掉了我头上的一半头发。请帮助我~如果有任何建议,我将不胜感激~OTL
解决方案
对于这个错误
TypeError:fsevents 不是构造函数
我必须在我的 Mac 上安装 watchman https://create-react-app.dev/docs/troubleshooting/#npm-test-hangs-or-crashes-on-macos-sierra
brew install watchman
推荐阅读
- python - 添加新事件后 Discord.py 事件不起作用
- javascript - 如何隐藏观众在同一个谷歌表中互相看到
- apache-poi - 如何将自定义图形添加到 Word 文档标题
- javascript - 在 jQuery 中拥有多个“setTimeout”的最佳方法是什么?
- wordpress - 需要在 Wordpress 中添加指向按钮的链接
- intellij-idea - IntelliJ UML 插件显示两个关系显示同一类依赖项的两个 UML 关系
- xampp - 数字数据类型的Mysql三等分问题
- python - 从孩子获取查询集对象以附加到父查询集
- javascript - 我使用了 styled-components 组件,我想在 Input 获得焦点时在它旁边显示一个按钮,但它不起作用
- apache-spark - Databricks Spark 引发 java.io.NotSerializableException:com.amazonaws.services.s3.AmazonS3Client