当前位置: 首页 > 知识库问答 >
问题:

react-native init SampleApp项目创建错误

程鸿煊
2023-03-14

我试图为react-native创建一个项目,但我得到了这个错误。

D:\Projects\PoC\ReactNative>react-native init TravelApp
This will walk you through creating a new React Native project in D:\Projects\PoC\ReactNative\TravelApp
Using yarn v1.22.4
Installing react-native...
yarn add v1.22.4
info No lockfile found.
[1/4] Resolving packages...
warning react-native > fbjs-scripts > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > metro-babel-register > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
[2/4] Fetching packages...
error https://registry.yarnpkg.com/@react-native-community/cli/-/cli-4.10.1.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "EPERM: operation not permitted, open 'C:\\Users\\sushant.patekar\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@react-native-community-cli-4.10.1-3c1e74f55c004936368d3576d4c1da7d02b89904-integrity\\node_modules\\@react-native-community\\cli\\build\\commands\\init\\printRunInstructions.js'"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
info There appears to be trouble with your network connection. Retrying...
Error: Command failed: yarn add react-native --exact
    at checkExecSyncError (child_process.js:611:11)
    at execSync (child_process.js:647:15)
    at run (C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules\react-native-cli\index.js:294:5)
    at createProject (C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
    at init (C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)
    at Object.<anonymous> (C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules\react-native-cli\index.js:153:7)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 4456,
  stdout: null,
  stderr: null
}
Command `yarn add react-native --exact` failed.

D:\Projects\PoC\ReactNative>yarn add react-native --exact
yarn add v1.22.4
info No lockfile found.
[1/4] Resolving packages...
warning react-native > fbjs > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs-scripts > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > metro-babel-register > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
[2/4] Fetching packages...
error https://registry.yarnpkg.com/@react-native-community/cli/-/cli-4.10.1.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "EPERM: operation not permitted, open 'C:\\Users\\sushant.patekar\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@react-native-community-cli-4.10.1-3c1e74f55c004936368d3576d4c1da7d02b89904-integrity\\node_modules\\@react-native-community\\cli\\build\\commands\\init\\printRunInstructions.js'"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

D:\Projects\PoC\ReactNative>npm install -g react-native-cli
C:\Users\sushant.patekar\AppData\Roaming\npm\react-native -> C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules\react-native-cli\index.js
+ react-native-cli@2.0.1
updated 1 package in 6.889s

D:\Projects\PoC\ReactNative>react-native init TravelApp_
This will walk you through creating a new React Native project in D:\Projects\PoC\ReactNative\TravelApp_
Using yarn v1.22.4
Installing react-native...
yarn add v1.22.4
info No lockfile found.
[1/4] Resolving packages...
warning react-native > fbjs-scripts > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > metro-babel-register > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[2/4] Fetching packages...
error https://registry.yarnpkg.com/@react-native-community/cli/-/cli-4.10.1.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "EPERM: operation not permitted, open 'C:\\Users\\sushant.patekar\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@react-native-community-cli-4.10.1-3c1e74f55c004936368d3576d4c1da7d02b89904-integrity\\node_modules\\@react-native-community\\cli\\build\\commands\\init\\printRunInstructions.js'"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Error: Command failed: yarn add react-native --exact
    at checkExecSyncError (child_process.js:611:11)
    at execSync (child_process.js:647:15)
    at run (C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules\react-native-cli\index.js:294:5)
    at createProject (C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
    at init (C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)
    at Object.<anonymous> (C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules\react-native-cli\index.js:153:7)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 5028,
  stdout: null,
  stderr: null
}
Command `yarn add react-native --exact` failed.

共有1个答案

薄高懿
2023-03-14

似乎与YARN/NPM的权限有关,EPERM:operation not Alperced

这里有一篇文章介绍如何解决这个问题,链接,它可能是您的防病毒程序或您没有足够的权限C:\users\sushant.patekar\appdata\roaming\npm\node_modules

您也可以清除您的npm包,这个答案可能会有帮助

 类似资料:
  • 我在Eclipse中创建maven项目时遇到了一个问题。发生以下错误: 无法计算生成计划:Plugin org.apache.maven。plugins:maven-resources-plugin:2.6或其一个依赖项无法解析:读取org.apache.maven的工件描述符失败。plugins:maven-resources-plugin:jar:2.6 pluginorg.apache.ma

  • 使用 @vue/cli 推荐用脚手架工具 @vue/cli 来创建一个使用 vue-loader 的项目: npm install -g @vue/cli vue create hello-vue cd hello-vue npm run serve # ready to go!

  • 点击顶部导航右上角"+"按钮,可进入创建项目页。 主要操作步骤: 选择目录:首先在本地文件浏览器中选择需要创建项目的目录,点击创建 选择模板:可选择预置脚手架或自定义脚手架 输入配置:输入项目需要的初始化信息 依赖安装:配置完成后系统会自动执行依赖安装 创建完成 San CLI UI中的文件浏览器可实现功能: 目录切换:可以通过点击路径切换,或者直接点击编辑后输入本地路径 目录收藏:对本地路径进行

  • 创建 Rust 项目 创建项目 我们首先创建一个整个项目的目录,并在工作目录中首先创建一个名为 rust-toolchain 的文件,并在其中写入所需要的工具链版本: rust-toolchain nightly-2020-06-27 之后在目录内部使用 cargo new 命令在我们的项目目录内创建一个新的 Rust 项目 os,命令如下: 运行命令 cargo new os 这里我们把项目

  • C:\Users\Price Charles 在C:\Users\Price Charles\larotiks中创建新的React应用程序。 安装包。这可能需要几分钟。使用cra模板安装反应、反应-多姆和反应-脚本... 我正在创建我的反应项目,但它总是卡在这里,不能继续创建我的项目。请帮帮我

  • 您好,感谢阅读本主题我与react合作我现在正在尝试学习安装react新应用程序时的卸载react新项目时显示错误我的问题是什么 在命令终端中 npm错误!在“…9.1”、“tslint config-p”附近进行分析时,JSON输入意外结束 npm错误!此运行的完整日志可在以下位置找到:npm ERR C:\Users\john\AppData\Roaming\npm-cache\u logs\