英文:
React native unable to download template
问题
I checked the /var/ directory and /T/rncli-init-template-c131XZ/node_modules/react-native/template.config.js does NOT exist. I tried looking online for the template to just make it myself but i could not find it, i don't really even know where to look.
我检查了/var/目录,发现/T/rncli-init-template-c131XZ/node_modules/react-native/template.config.js文件不存在。我尝试在网上寻找这个模板以便自己创建,但是我找不到它,我也不知道该在哪里找。
I followed the github link but i obviously do not want to create a custom template.
我按照GitHub链接的指示进行了操作,但显然我不想创建自定义模板。
I did follow the documentation to install xcode cli tools and the correct version of ruby 2.7.6.
我确实按照文档的指示安装了Xcode CLI工具和正确版本的Ruby 2.7.6。
英文:
Command
npx react-native@latest init AwesomeProject
Output
✔ Downloading template
✖ Copying template
error Error: Couldn't find the "/var/folders/8x/y10dxy554tzb5d5d2tv_rffh0000gn/T/rncli-init-template-c131XZ/node_modules/react-native/template.config.js file inside "react-native" template. Please make sure the template is valid. Read more: https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template.
Error: Error: Couldn't find the "/var/folders/8x/y10dxy554tzb5d5d2tv_rffh0000gn/T/rncli-init-template-c131XZ/node_modules/react-native/template.config.js file inside "react-native" template. Please make sure the template is valid. Read more: https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template
at createFromTemplate (/Users/rmunoz/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:131:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.initialize [as func] (/Users/rmunoz/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:184:3)
at async Command.handleAction (/Users/rmunoz/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.
I checked the /var/ directory and /T/rncli-init-template-c131XZ/node_modules/react-native/template.config.js does NOT exist. I tried looking online for the template to just make it myself but i could not find it, i don't really even know where to look.
I followed the github link but i obviously do not want to create a custom template.
I did follow the documentation to install xcode cli tools and the correct version of ruby 2.7.6
答案1
得分: 1
以下是翻译好的部分:
在你正在遵循的说明顶部有一个非常明确的警告:
注意:如果你的计算机上同时安装了
yarn
和npm
,React Native CLI将始终尝试使用yarn
,因此,即使你使用npx
工具,只有react-native
可执行文件将使用npm
安装,其余工作将委托给yarn
。你可以通过在命令中添加--npm
标志来强制使用npm
。
你需要使用--npm
重新运行你的命令:
npx react-native@latest init AwesomeProject --npm
此外,你应该花些时间阅读有关标签的信息。观察错误消息应该表明,唯一相关的标签是react-native
,因为该命令永远不会超出运行react-native@latest init
的初始阶段。
英文:
There is a very clear warning at the top of the instructions you're following:
> Note: If you have both yarn
and npm
installed on your machine, React Native CLI will always try to use yarn
, so even if you use npx
utility, only react-native
executable will be installed using npm
and the rest of the work will be delegated to yarn
. You can force usage of npm
adding --npm
flag to the command.
You need to re-run your command with --npm
:
npx react-native@latest init AwesomeProject --npm
Additionally, you should take some time to read about tags. Observing the error message should indicate that the only relevant is react-native
as the command never proceeds beyond the initial stages of running react-native@latest init
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论