node.js - 找不到模块:无法解析“perf_hooks”ReactJS
问题描述
我正在使用 typescript 处理 reactjs (17.0.1) (node v15.11.0) 并且收到此警告消息,知道如何解决吗?
./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
./node_modules/typescript/lib/typescript.js
Module not found: Can't resolve 'perf_hooks' in '/Users/jorge/Documents/Development/Projects/React-Js/project/node_modules/typescript/lib'
提前致谢
解决方案
在处理只有前端的 Next.JS 应用程序并在稍后添加 TS 时,我遇到了同样的错误。我相信这与 NPM TypeScript Node 包有关。我通过运行解决了它:
npm i typescript @types/react @types/node
安装所有 TypeScipt 依赖项(包括 Node)
推荐阅读
- java - 您将如何使用 Spring 创建具有多个可选参数的 RESTful 服务
- java - 本地类不兼容:流 classdesc
- python - 数组中大数的索引
- git - 为什么'git push'(没有-f)会覆盖远程历史?[GitHub]
- node.js - 来自后端的输入验证显示在控制台上,但不显示在前端 React、nodejs 引导程序上
- c# - C# 扩展列表
对于 DateTime 属性之一 - python - 如何在 aws lambda 中设置 git config
- r - R 排除统计数据中的异常值
- javascript - 获取源时区的小时数
- database - 如何在 MS Access 中打开导航表单到特定选项卡