初始化React、Expo、Next项目时npx命令无限挂起求助
项目初始化命令无限挂起求助
执行以下命令初始化项目时,均出现无限挂起的问题:
npx create-react-appnpx create-expo-appnpx create-next-app
示例执行命令:
C:\Users\james\Documents>npx create-expo-app@latest my-app
执行后,旋转进度动画(|/-|)仅运行约2次就彻底停滞,等待数小时仍无任何进展,只能通过Ctrl + C终止任务。
已尝试的解决方法
- 多次重启电脑
- 多次卸载重装Node.js(包括使用fnm快速Node版本管理器)
- 测试不同版本的Node.js:v18.20.4 LTS、v20.15.1 LTS、v22.5.0
- 在Windows CMD(含管理员权限)、Windows PowerShell、VS Code终端中分别执行命令
- 执行
npm config set registry http://registry.npmjs.org/ --global切换为npm官方镜像源,问题依旧 - 执行
npm cache clear --force强制清除npm缓存,问题依旧 - 全局安装
create-expo-app后再执行初始化命令,问题未解决 - 尝试用Yarn安装:出现大量版本兼容警告(内容如下),随后进度条停在
[---------------------------------------------------------------------------------------------------------------] 0/719处不再推进
Yarn安装时的警告信息:
warning expo > @expo/cli > glob@7.2.3: Glob versions prior to v9 are no longer supported warning expo > babel-preset-expo > @react-native/babel-preset > @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead. warning expo > @expo/cli > @expo/rudder-sdk-node > @expo/bunyan > mv > rimraf@2.4.5: Rimraf versions prior to v4 are no longer supported warning expo > @expo/cli > @expo/rudder-sdk-node > @expo/bunyan > mv > rimraf > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. warning "expo > babel-preset-expo > @react-native/babel-preset > @react-native/babel-plugin-codegen > @react-native/codegen > jscodeshift@0.14.0" has unmet peer dependency "@babel/preset-env@^7.1.6".
当前系统信息
Windows 11 > node -v v22.5.0 >npm -v 10.8.2
内容的提问来源于stack exchange,提问作者James
相关产品推荐
相关产品推荐

