【问题标题】:react-native init SampleApp Project creation errorreact-native init SampleApp 项目创建错误
【发布时间】:2020-10-19 09:15:45
【问题描述】:

我试图为 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.

【问题讨论】:

  • 请通过添加代码样式和一些有关问题的文本详细信息(不仅是日志)来清理您的帖子,这将使想要帮助您的人更容易阅读:)

标签: node.js react-native npm


【解决方案1】:

yarn/npm 的权限似乎有问题,EPERM: operation not permitted

这是一篇关于你可以做些什么来解决这个问题的文章,link,它可能是你的杀毒软件或者你没有足够的权限来C:\Users\sushant.patekar\AppData\Roaming\npm\node_modules

你也可以清除你的 npm 包,answer 会很有帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-13
    • 2021-03-09
    • 2021-04-03
    • 2020-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-09
    相关资源
    最近更新 更多