【发布时间】:2021-07-22 10:38:34
【问题描述】:
当使用 npx create-react-app 创建一个新的 react 项目时,进程停止并出现错误:internal/modules/cjs/loader.js:311。
内部/模块/cjs/loader.js:311 抛出错误; ^ 错误:找不到模块“C:\Users\shonm\Desktop\Web Development\WebSites\test1\node_modules\fs-extra\lib\index.js”。请验证 package.json 是否具有有效的“main” 进入
PS C:\Users\shonm\Desktop\Web Development\WebSites> npx create-react-app test1
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.3.2: The platform "win32" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
.......
Done in 30.17s.
**internal/modules/cjs/loader.js:311
throw err;
^
Error: Cannot find module 'C:\Users\shonm\Desktop\Web Development\WebSites\test1\node_modules\fs-extra\lib\index.js'. Please verify that the package.json has a valid "main"
entry**
at tryPackage (internal/modules/cjs/loader.js:303:19)
requestPath: 'fs-extra'
}
Aborting installation.
node has failed.
Deleting generated file... node_modules
【问题讨论】:
标签: node.js reactjs npm create-react-app yarnpkg