javascript 节点:内部/模块/cjs/加载程序:936抛出错误;^错误:找不到模块“sex-channel ',当我运行“npm start”时

jhkqcmku  于 2023-02-15  发布在  Java
关注(0)|答案(3)|浏览(377)

当我运行npm start查看我的react应用程序时遇到了这个错误。

> react-scripts start

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'side-channel'
Require stack:
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\qs\lib\stringify.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\qs\lib\index.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\node_modules\express\lib\middleware\query.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\node_modules\express\lib\application.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\node_modules\express\lib\express.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\node_modules\express\index.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\lib\Server.js       
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\react-scripts\scripts\start.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\qs\lib\stringify.js:3:22)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\qs\\lib\\stringify.js',     
    'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\qs\\lib\\index.js',
    'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\lib\\middleware\\query.js',
    'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\lib\\application.js',
ules\\express\\lib\\application.js',
    'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\lib\\express.js',
    'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\lib\\express.js',
    'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\index.js',
    'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\lib\\Server.js',
    'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\react-scripts\\scripts\\start.js'
  ]
}

然后我尝试使用以下命令安装模块:

npm i side-channel

我仍然得到一个错误:

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\USER-PC\AppData\Local\npm-cache\_logs\2022-10-04T15_30_26_716Z-debug-0.log

可能是什么问题?我在用“npm install”命令安装依赖项后立即运行了start命令。

njthzxwz

njthzxwz1#

现在起作用了,我必须删除我项目中的yarn.lock,删除node_modules文件后,我再次运行命令:npm install

qf9go6mv

qf9go6mv2#

对于这个问题,我找到的最好的解决方案是unistall和重新安装react。

这将卸载React

以确保它在那里并显示依赖项

npm ls -g --depth=0

输出:

F:\Dev\NodeJS\node22
+-- create-react-app@5.0.1
+-- express@4.14.0

要卸载运行

npm unistall -g create-react-app

安装运行

npm install -g create-react-app
3xiyfsfu

3xiyfsfu3#

您可以尝试删除node_modules,然后使用npm install重新安装所有模块
要显示自npm 7 for windows起的模块:

Global modules: npm ls --link --global

Local modules: npm ls --link

卸载包运行

npm uninstall <module_name>

要安装,只需运行

npm install <module_name>

相关问题