简体   繁体   English

React Native 无法 npx init 项目,找不到模块错误

[英]React Native cannot npx init project, cannot find module error

npx react-native init MyApp npx react-native init MyApp

√ Downloading template × Copying template error Error: Cannot find module 'C:\\Users\\%%%%\\AppData\\Local\\Temp\\rncli-init-template-rVvcjE\\node_modules\\react-native\\template.config' Require stack: - C:\\Users\\%%%%%\\node_modules\\react-native\\node_modules@react-native-community\\cli\\build\\commands\\init\\template.js - C:\\Users\\%%%%%\\node_modules\\react-native\\node_modules@react-native-community\\cli\\build\\commands\\init\\init.js - C:\\Users\\%%%%%\\node_modules\\react-native\\node_modules@react-native-community\\cli\\build\\commands\\init\\index.js - C:\\Users\\%%%%%\\node_modules\\react-native\\node_modules@react-native-community\\cli\\build\\commands\\index.js - C:\\Users\\%%%%%\\node_modules\\react-native\\node_modules@react-native-community\\cli\\build\\index.js - C:\\Users\\%%%%%\\node_modules\\react-native\\cli.js √ Downloading template × Copying template error Error: Cannot find module 'C:\\Users\\%%%%\\AppData\\Local\\Temp\\rncli-init-template-rVvcjE\\node_modules\\react-native\\template.config' Require stack: - C:\\Users\\%%%%%\\node_modules\\react-native\\node_modules@react-native-community\\cli\\build\\commands\\init\\template.js - C:\\Users\\%%%%%\\node_modules \\react-native\\node_modules@react-native-community\\cli\\build\\commands\\init\\init.js - C:\\Users\\%%%%%\\node_modules\\react-native\\node_modules@react-native-community\\ cli\\build\\commands\\init\\index.js - C:\\Users\\%%%%%\\node_modules\\react-native\\node_modules@react-native-community\\cli\\build\\commands\\index.js - C:\\用户\\%%%%%\\node_modules\\react-native\\node_modules@react-native-community\\cli\\build\\index.js - C:\\Users\\%%%%%\\node_modules\\react-native\\cli.js

npx react-native info npx 反应本机信息

info Fetching system and libraries information... System: OS: Windows 10 10.0.18363 CPU: (8) x64 AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx Memory: 3.88 GB / 6.80 GB Binaries: Node: 12.13.1 - C:\\Program Files\\nodejs\\node.EXE npm: 6.12.1 - C:\\Program Files\\nodejs\\npm.CMD SDKs: Android SDK: API Levels: 21, 22, 23, 24, 25, 26, 27, 28, 29 Build Tools: 28.0.3, 29.0.2 IDEs: Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5977832 npmPackages: react-native: 0.61.5 => 0.61.5 info 正在获取系统和库信息... 系统:操作系统:Windows 10 10.0.18363 CPU:(8) x64 AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx 内存:3.88 GB / 6.80 GB 二进制文件:节点:12.13.1 - C: \\Program Files\\nodejs\\node.EXE npm: 6.12.1 - C:\\Program Files\\nodejs\\npm.CMD SDKs: Android SDK: API Levels: 21, 22, 23, 24, 25, 26, 27, 28, 29 构建工具:28.0.3、29.0.2 IDE:Android Studio:版本 3.5.0.0 AI-191.8026.42.35.5977832 npmPackages:react-native:0.61.5 => 0.61.5

To avoid unnecessary responses npm uninstall react-native-cli -g has been already done.为了避免不必要的响应 npm uninstall react-native-cli -g 已经完成。

rncli-init-template-rVvcjE from the file path mentioned above does not even exist and I am not sure why.上面提到的文件路径中的 rncli-init-template-rVvcjE 甚至不存在,我不知道为什么。 Thanks, everybody for help in advance I am new to stack overflow I have only been programming competitively so far.谢谢,大家提前寻求帮助我是堆栈溢出的新手,到目前为止我只参与过竞争性编程。 No stranger to algorithms but for cross-platform development frameworks, I'm a newbie.对算法并不陌生,但对于跨平台开发框架,我是一个新手。

Try to init with yarn.尝试用纱线初始化。 Yarn has a better performance than npm ( link July 2019 ). Yarn 的性能优于 npm(链接 2019 年 7 月)。

Install yarn first先安装yarn

npm install -g yarn

Install react-native-cli.安装 react-native-cli。 If don't work try with sudo.如果不起作用,请尝试使用 sudo。

yarn global add react-native-cli

Create yout project创建你的项目

react-native init myapp

Related post 相关帖子

  1. first uninstall your nodejs using nodejs setup(the same version you have installed)首先使用 nodejs setup 卸载你的 nodejs(与你安装的版本相同)
  2. reboot your computer (optional)重新启动计算机(可选)
  3. after all install again nodejs (nodejs.org/en/download/) and all will be fine.毕竟再次安装 nodejs (nodejs.org/en/download/) 一切都会好起来的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 npx找不到模块'webpack' - npx cannot find module 'webpack' npx react-native init MainApp Giving 错误(代码:'MODULE_NOT_FOUND',)。 这里有什么问题 - npx react-native init MainApp Giving error (code: 'MODULE_NOT_FOUND',) . What's the isue here 加载React Native:UnhandledPromiseRejectionWarning:错误:找不到模块'View' - Loading React Native: UnhandledPromiseRejectionWarning: Error: Cannot find module 'View' BABEL 找不到模块“节点:路径”错误 react-native - BABEL Cannot find module 'node:path' error react-native 错误:找不到模块“ reative-native” /未找到模块:错误:无法解析模块“ react-native-web” - Error: Cannot find module “react-native” / Module not found: Error: Cannot resolve module 'react-native-web' 反应本地博览会找不到模块'minizlib' - react native expo Cannot find module 'minizlib' 找不到模块'react-native' - Cannot Find Module 'react-native' 找不到模块'setupDevtools'React-Native - Cannot find module 'setupDevtools' React-Native 错误:尝试安装 react 应用程序时找不到模块“react-scripts/scripts/init.js” - Error: cannot find module "react-scripts/scripts/init.js' when tryping to install react app create-react-app 错误:找不到模块“react-scripts/scripts/init.js” - create-react-app Error: Cannot find module 'react-scripts/scripts/init.js'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM