简体   繁体   English

react-native init SampleApp 项目创建错误

[英]react-native init SampleApp Project creation error

I was trying to create a project for react-native but I am getting this error.我试图为 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.

It seems like a problem with permission with yarn/npm, EPERM: operation not permitted yarn/npm 的权限似乎有问题, EPERM: operation not permitted

Here's a article on what you could do to fix that, link , it can be your Antivirus or you have not enough permissions to C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules这是一篇关于你可以做些什么来解决这个问题的文章, 链接,它可以是你的防病毒软件,或者你对C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules没有足够的权限

Also you can clear your npm packages, this answer can be helpful您也可以清除您的 npm 包,这个答案可能会有所帮助

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM