cli icon indicating copy to clipboard operation
cli copied to clipboard

✖ Installing Bundler error Error: Looks like your iOS environment is not properly set.

Open laurencebedford opened this issue 2 years ago • 28 comments

Environment

info Fetching system and libraries information...
System:
    OS: macOS 13.0.1
    CPU: (8) arm64 Apple M1
    Memory: 161.55 MB / 8.00 GB
    Shell: 3.2.57 - /bin/sh
  Binaries:
    Node: 18.12.1 - /usr/local/bin/node
    Yarn: 1.22.11 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    Watchman: 2023.01.23.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: Not Found
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found


Description

Issue Occurring on MAC OS M1 chip - I am not the only one with this: I opened this issue here on the react-native GitHub and was told this is a bug and post it here by @cortinico

https://stackoverflow.com/questions/75040578/i-got-a-problem-installing-bundler-when-trying-create-my-new-react-native-projec

  • except I have Xcode installed and I have other projects using expo which run perfectly with simulators etc etc
✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing Bundler
error Ignoring ffi-1.15.4 because its extensions are not built. Try: gem pristine ffi --version 1.15.4
Ignoring ffi-1.15.3 because its extensions are not built. Try: gem pristine ffi --version 1.15.3
Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2

✖ Installing Bundler
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
    at createFromTemplate (/private/var/root/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/init/init.js:129:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.initialize [as func] (/private/var/root/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/init/init.js:181:3)
    at async Command.handleAction (/private/var/root/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.

Version

10.1.3

Reproducible Demo

npx react-native init newProject

Snack, code example, screenshot, or link to a repository

laurencebedford avatar Feb 15 '23 15:02 laurencebedford

Looks like bundler installation failed for you. Could you try solution proposed here?

adamTrz avatar Feb 17 '23 14:02 adamTrz

Looks like bundler installation failed for you. Could you try solution proposed here?

None work same issues occurring - been playing around with this for a while.

laurencebedford avatar Feb 22 '23 16:02 laurencebedford

Hey @laurencebedford, I fixed a similar issue by changing my Ruby version to the proper one. Please ensure you have this version of Ruby. What I did:

  1. installed rbenv. Please make sure you copy and paste this line eval "$(rbenv init - zsh)" at the end of the .zschr file after installation. Optional: you might need to install Xcode dev tools, run xcode-select --install in terminal
  2. install ruby version using the version manager above
  3. set it as global/local Optional: the command above might not work if you have .ruby-version file, delete file and try again
  4. make sure you set it properly by running rbenv versions docs
  5. run npx react-native@latest init AwesomeProject

nazmeln avatar Mar 04 '23 19:03 nazmeln

I am having this issue on an Intel Mac. First timer following: https://reactnative.dev/docs/environment-setup

info Fetching system and libraries information...
System:
    OS: macOS 12.6.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 196.89 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.13.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.6.0 - /usr/local/bin/npm
    Watchman: 2023.03.06.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 29, 30, 31
      Build Tools: 32.0.0
      System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-31 | Intel x86 Atom_64, android-31 | Google APIs Intel x86 Atom_64, android-31 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8512546
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_321 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.3 => 0.71.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

klwdallas avatar Mar 07 '23 23:03 klwdallas

I had this issue too in an Intel Mac. Anyone know how to fix this?

whoCanStopMe avatar Mar 16 '23 01:03 whoCanStopMe

我在 Intel Mac 上也遇到过这个问题。有人知道怎么修这个东西吗? 我也是,真无语,官方cli出问题,imac m1 出现一样的问题

huangtian615 avatar Mar 16 '23 07:03 huangtian615

Hey @laurencebedford, I fixed a similar issue by changing my Ruby version to the proper one. Please ensure you have this version of Ruby. What I did:

  1. installed rbenv. Please make sure you copy and paste this line eval "$(rbenv init - zsh)" at the end of the .zschr file after installation. Optional: you might need to install Xcode dev tools, run xcode-select --install in terminal
  2. install ruby version using the version manager above
  3. set it as global/local Optional: the command above might not work if you have .ruby-version file, delete file and try again
  4. make sure you set it properly by running rbenv versions docs
  5. run npx react-native@latest init AwesomeProject

Sorry it has been two week, this does not work.

laurencebedford avatar Mar 17 '23 14:03 laurencebedford

我在 Intel Mac 上也遇到过这个问题。有人知道怎么修这个东西吗? 我也是,真无语,官方cli出问题,imac m1 出现一样的问题

Translation:

I also had this problem on an Intel Mac. Does anyone know how to fix this thing? Me too, really speechless, the official cli has a problem, and the imac m1 has the same problem

This is completely correct this issue is leaving M1 chip users screwed over currently.

laurencebedford avatar Mar 17 '23 14:03 laurencebedford

It's 17th April. This issue is not fixed yet. I am still facing the issue.

Visharada avatar Apr 17 '23 16:04 Visharada

hey @Visharada we'd appreciate some help from you on this one :)

thymikee avatar Apr 17 '23 17:04 thymikee

I am also facing the same issue. I am tried lot's of solutions from both Github and StackOverFlow but nothing worked.

saadh393 avatar Apr 24 '23 06:04 saadh393

Am seeing a very similar issue on an M1 Macbook. I tried using ruby version 2.7.6 per @nazmeln's suggestion however when trying to run: npx react-native init DetoxExample --template react-native-template-typescript

I get the error:

✔ Installing Bundler
✖ Installing CocoaPods dependencies (this may take a few minutes)
error warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md

✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
    at createFromTemplate (/Users/jason/.npm/_npx/7930a8670f922cdb/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/jason/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/init/init.js:184:3)
    at async Command.handleAction (/Users/jason/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.

Not sure if it's relevant, however in that stacktrace, the cocoapods gem seems to be vendored with ruby 2.7.0, not sure if that's introducing an incompatibility issue.

jkotchoff avatar Apr 28 '23 01:04 jkotchoff

@jkotchoff Have you tried reinstalling the Ruby version using another version manager, like RVM? Hope it helps, also, don't forget to relaunch the terminal every time after changing Ruby version.

nazmeln avatar Apr 28 '23 08:04 nazmeln

@jkotchoff Have you tried reinstalling the Ruby version using another version manager, like RVM? Hope it helps, also, don't forget to relaunch the terminal every time after changing Ruby version.

I use ASDF and am very familiar with Ruby, that's not the problem.

jkotchoff avatar Apr 29 '23 13:04 jkotchoff

following script fix it for me brew install libffi ln -s $(brew --cellar libffi)/*/include/ffi.h /usr/local/include/ffi.h ln -s $(brew --cellar libffi)/*/include/ffitarget.h /usr/local/include/ffitarget.h referred to this thread: https://github.com/ffi/ffi/issues/814#issuecomment-677655537

qi-xia avatar May 18 '23 00:05 qi-xia

following script fix it for me brew install libffi ln -s $(brew --cellar libffi)/*/include/ffi.h /usr/local/include/ffi.h ln -s $(brew --cellar libffi)/*/include/ffitarget.h /usr/local/include/ffitarget.h referred to this thread: ffi/ffi#814 (comment)

Solved my error thanks

imorakzai avatar May 24 '23 12:05 imorakzai

This issue is not fixed yet. I am still facing the issue.

Node version : 16.15.1 ruby version: 2.6.10p210 xCode version : 14.1

Screenshot 2023-05-29 at 5 45 59 PM

Screenshot 2023-05-29 at 4 55 15 PM

priyankgandhi0 avatar May 29 '23 12:05 priyankgandhi0

following script fix it for me brew install libffi ln -s $(brew --cellar libffi)/*/include/ffi.h /usr/local/include/ffi.h ln -s $(brew --cellar libffi)/*/include/ffitarget.h /usr/local/include/ffitarget.h referred to this thread: ffi/ffi#814 (comment)

Still facing the same issue.

priyankgandhi0 avatar May 29 '23 12:05 priyankgandhi0

Still getting the same error :

`error Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/darimuhittin/Desktop/WORK/case_studies/ilker_aydin_case/GamesApp/vendor/bundle/ruby/2.7.0/gems/json-2.6.3/ext/json/ext/generator /Users/darimuhittin/.rbenv/versions/2.7.6/bin/ruby -I /Users/darimuhittin/.rbenv/versions/2.7.6/lib/ruby/2.7.0 -r ./siteconf20230530-51959-e4q9t5.rb extconf.rb creating Makefile

current directory: /Users/darimuhittin/Desktop/WORK/case_studies/ilker_aydin_case/GamesApp/vendor/bundle/ruby/2.7.0/gems/json-2.6.3/ext/json/ext/generator make "DESTDIR=" clean

current directory: /Users/darimuhittin/Desktop/WORK/case_studies/ilker_aydin_case/GamesApp/vendor/bundle/ruby/2.7.0/gems/json-2.6.3/ext/json/ext/generator make "DESTDIR=" compiling generator.c linking shared-object json/ext/generator.bundle ld: building for iOS Simulator, but linking in dylib built for macOS, file '/Users/darimuhittin/.rbenv/versions/2.7.6/lib/libruby.2.7.dylib' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [generator.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/darimuhittin/Desktop/WORK/case_studies/ilker_aydin_case/GamesApp/vendor/bundle/ruby/2.7.0/gems/json-2.6.3 for inspection. Results logged to /Users/darimuhittin/Desktop/WORK/case_studies/ilker_aydin_case/GamesApp/vendor/bundle/ruby/2.7.0/extensions/arm64-darwin-22/2.7.0/json-2.6.3/gem_make.out

An error occurred while installing json (2.6.3), and Bundler cannot continue. Make sure that gem install json -v '2.6.3' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile: cocoapods was resolved to 1.12.1, which depends on cocoapods-core was resolved to 1.12.1, which depends on algoliasearch was resolved to 1.27.5, which depends on json

✖ Installing Bundler error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS. Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS. at createFromTemplate (/Users/darimuhittin/.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/darimuhittin/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:184:3) at async Command.handleAction (/Users/darimuhittin/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/index.js:106:9) info Run CLI with --verbose flag for more details.`

anyone can help with this ?

darimuhittin avatar May 30 '23 12:05 darimuhittin

I have the same issue in M2 chip, anyone help? i cant create new projects..

Sepudev avatar May 31 '23 03:05 Sepudev

Here is my solution.

I encounter this error as well although have probably set appropriate ruby version using rbenv.

Turn out the error comes from dependency installations with pod install. The error did not displayed at all with the init project command.

You guys can try cd to the project/ios and perform pod install to see if there is any error here and follow the instructions in the error messages. For me it just to do pod install --repo-update manually 🎉

khoanguyen-yang avatar Jul 28 '23 09:07 khoanguyen-yang

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

github-actions[bot] avatar Oct 27 '23 03:10 github-actions[bot]

The error still exists

southLand1101 avatar Nov 01 '23 15:11 southLand1101

@laurencebedford I have the same error with you.How can I resolve it ?

lijun0222 avatar Nov 15 '23 05:11 lijun0222

Same error on my side, with M1.

PanArnaud avatar Nov 15 '23 08:11 PanArnaud

I have the exact same issue using M1

israx avatar Dec 15 '23 19:12 israx

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

github-actions[bot] avatar Mar 15 '24 03:03 github-actions[bot]

I have the exact same issue using Mac Intel

romanmiftakhur avatar Mar 22 '24 03:03 romanmiftakhur

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

github-actions[bot] avatar Jun 21 '24 03:06 github-actions[bot]