-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS Build Error with npx react-native
| UPDATE: Potential $CDPATH collision
#35747
Comments
Round 2: Re-runTo ensure CDPATH was not a factor I unset it. Now I get an error when initializing a new project: unset CDPATH
npx react-native init Test2 ###### ######
### #### #### ###
## ### ### ##
## #### ##
## #### ##
## ## ## ##
## ### ### ##
## ######################## ##
###### ### ### ######
### ## ## ## ## ###
### ## ### #### ### ## ###
## #### ######## #### ##
## ### ########## ### ##
## #### ######## #### ##
### ## ### #### ### ## ###
### ## ## ## ## ###
###### ### ### ######
## ######################## ##
## ### ### ##
## ## ## ##
## #### ##
## #### ##
## ### ### ##
### #### #### ###
###### ######
Welcome to React Native!
Learn once, write anywhere
✔ Downloading template
✔ Cop
8000
ying template
✔ Processing template
✔ 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.11.3/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/developer/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/init/init.js:169:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.initialize [as func] (/Users/developer/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/commands/init/init.js:222:3)
at async Command.handleAction (/Users/developer/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/index.js:140:9)
info Run CLI with --verbose flag for more details. Tell me this isn't weird. So I shutdown the simulator, opened a new shell session keeping the CDPATH, and ran the above code again -- it worked 🥰 So I delete the project ( After building, I opened a new terminal session and just started everything up with CDPATH (on the project I created without CDPATH) just to see if it would complain. It ran without issue. Is it common for React (perhaps on lower performing devices) to have init errors? Final Re-RunRan through the whole init/start/build phase one more time, again with CDPATH and the startup passes but the build fails again (like the initial post) pointing to the generate-specs-cli.js in another project directory on the CDPATH. 🤬 Kind of interested to hear if someone has thoughts. I've cleared out the ~/.../DerivedData/* directories and files between builds to ensure that wasn't a conflict. It seems inconsistent and I haven't narrowed down if the CDPATH matters at all, or if it matters during a particular phase. For instance, maybe it's important not to have it during the
ClarificationI modified the full path of the CDPATH above. Let's say it was failing to find this file:
|
npx react-native
| UPDATE: Potential $CDPATH collision
Final? ThoughtsThe issue may have been related to exporting CDPATH. I intentionally General online recommendations are not to export CDPATH as they may interfere with commands on the command line, which is what is occuring. This is the first time after decades that it has interfered with anything. Also interesting, in the ruby gems that come loaded with react-native project's (i.e. vendor/bundle/ruby/2.7.0/gems) there are many files that intentionally delete or unset CDPATH. I'm guessing something in the react-native ios pipeline also needs to clear out the environment variable as a precaution. Examples where it's done:TestProject/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/pod_source_preparer.rb:62:
ENV.delete('CDPATH')
TestProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/man/Makefile.in:76:
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
TestProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c/libffi/ltmain.sh:144:
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
... It seems Expo is good about it too: ~/.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/build/commands/utils/CreateApp.js:184:
const cdPath = path().relative(process.cwd(), projectRoot);
~/.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/build/commands/utils/CreateApp.js:185:
if (cdPath.length <= projectRoot.length) {
~/.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/build/commands/utils/CreateApp.js:186:
return cdPath;
~/.nvm/versions/node/v18.12.1/lib/node_modules/expo-cli/build/commands/initAsync.js:385:
const cdPat = CreateApp().getChangeDirectoryPath(projectRoot);
... I've re-run the creation scripts with CDPATH set, but not exported and I think the issue is resolved. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Oh my. @devophyte you're my hero for the day. I also had set (and forgot about) The fix in my case:
|
Unbelievable! |
Description
Not sure this is a bug. I'm new to React Native and encountered build errors. I switched to using Expo, which worked, but wanted to figure out what it is that is interfering with a vanilla install of React on a hardly used MacBook Air.
Fresh install of Xcode 14.2 and Command Line Tools for Xcode.
The project creates,
yarn start
spins up Metro, butyarn ios
encounters an error during the build process.BuildError.log
Version
0.70.6
Output of
npx react-native info
Steps to reproduce
Terminal 1
Terminal 2
Snack, code example, screenshot, or link to a repository
None.
Comments / Interesting Discoveries
Something odd (found in the attached log) is an error that seems to be pointing to a .js file in an unrelated node project. On this machine the only reason I can think that it would search there would be due to overloading the CDPATH (i.e.
export CDPATH=~/node-apps/sails:$CDPATH
) in ~/.bashrcRemoving that from the equation (
unset CDPATH
) and a build error still occurs.Oddly, I ran it again and build error with output too long, so went to redirect to a file (
> BuildError.log
) then quickly noticed that was going to log standard output, so issued a Command+C to quit the process and (2> BuildError.log
) to capture the error messages. What happened? ... it ran successfully?I have no idea what's going on.
That's the STDOUT output. The BuildError.log is a bunch of build and expected output, but I don't get why it worked this time after a few failures. I'm going to walk through the steps again.
The text was updated successfully, but these errors were encountered: