node.js - 为什么 npm start 给我“错误:找不到模块'./keywords'”?
问题描述
尝试npm start
与 Create React App 一起使用来启动我的反应应用程序,但收到此错误:
node:internal/modules/cjs/loader:943
throw err;
^
Error: Cannot find module './keywords'
Require stack:
- D:\social-ribbon\node_modules\ajv-keywords\index.js
- D:\social-ribbon\node_modules\webpack\node_modules\schema-utils\src\validateOptions.js
- D:\social-ribbon\node_modules\webpack\node_modules\schema-utils\src\index.js
- D:\social-ribbon\node_modules\webpack\lib\SourceMapDevToolPlugin.js
- D:\social-ribbon\node_modules\webpack\lib\WebpackOptionsApply.js
- D:\social-ribbon\node_modules\webpack\lib\webpack.js
- D:\social-ribbon\node_modules\react-scripts\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at Function.Module._load (node:internal/modules/cjs/loader:773:27)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (D:\social-ribbon\node_modules\ajv-keywords\index.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19) {
requireStack: [
'D:\\social-ribbon\\node_modules\\ajv-keywords\\index.js',
'D:\\social-ribbon\\node_modules\\webpack\\node_modules\\schema-utils\\src\\validateOptions.js',
'D:\\social-ribbon\\node_modules\\webpack\\node_modules\\schema-utils\\src\\index.js',
'D:\\social-ribbon\\node_modules\\webpack\\lib\\SourceMapDevToolPlugin.js',
'D:\\social-ribbon\\node_modules\\webpack\\lib\\WebpackOptionsApply.js',
'D:\\social-ribbon\\node_modules\\webpack\\lib\\webpack.js',
'D:\\social-ribbon\\node_modules\\react-scripts\\scripts\\start.js'
]
}
有人建议搜索名为“keywords”的文件,但该词仅作为ajv-keywords
or的一部分出现在文件中css-color-keywords
。其他人建议重新安装整个node-modules
文件夹,但这听起来有点激烈。我现在请你帮忙。谢谢你的帮助。
解决方案
我也面临同样的问题。我所做的是删除节点模块文件夹并重新安装它。我也会分享命令
rm -R node_modules
npm cache --force clean
npm cache --force clear
npm install
npm start
希望这有效。它对我有用,但在我的情况下,有一个 avj-keywords 文件夹。
推荐阅读
- bash - 从文件夹中删除一个文件到它的名字(bash)
- node.js - UnknownEndpoint:无法访问的主机:“Bucket_Name.s3.ap-south-1.amazonaws.com”。此服务可能在“ap-south-1”区域不可用
- ms-access - MS Access 365 不显示指向新添加的 Sharepoint 库条目的名称超链接
- powershell - 将 powerhell 输出传递给命令以卸载 Google Chrome
- python - 字节类型与base64类型错误有问题:需要一个类似字节的对象,而不是'str'
- linux - Web 部署任务失败(无法完成对远程代理 URL https://xx.publish.azurewebsites.windows.net/msdeploy.axd?site=XXXXXXX 的请求)
- asp.net-mvc - javascript intellisense 总是导致 MVC 崩溃
- python - 如何模拟对 secretsmanager 的 boto3 客户端会话请求以返回特定响应或引发异常
- javascript - javascript中的动态列表如何从特定调用函数
- python - python中的双向通信Socket.IO