Run shell script failed when I use Xcode to build project with release deployment. - ios

Issue Description
The log of error when build project looks like below.
node /Users/niyao/Company/Projects/EVE/EVERN/node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --reset-cache --bundle-output /Users/niyao/Library/Developer/Xcode/DerivedData/EVE-bzggtbnrxixkvwgqyewmpxepvljo/Build/Products/Release-iphonesimulator/EVE.app/main.jsbundle --assets-dest /Users/niyao/Library/Developer/Xcode/DerivedData/EVE-bzggtbnrxixkvwgqyewmpxepvljo/Build/Products/Release-iphonesimulator/EVE.app
fs.js:584
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
Error: ENOENT: no such file or directory, open 'package.json'
Error Scenario
After I use package.json as below to npm instal new version, the error happens within release deployment scheme.
{
"name": "NYProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"lint": "./node_modules/eslint/bin/eslint.js index.ios.js index.android.js react/",
"watch": "npm-watch"
},
"watch": {
"lint": {
"patterns": [
"react",
"index.ios.js",
"index.android.js"
],
"extensions": "js",
"ignore": ".node_modules",
"quiet": false
}
},
"dependencies": {
"react": "15.3.1",
"react-native": "^0.32.0",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
"redux-logger": "^2.6.1",
"redux-thunk": "^2.1.0"
},
"devDependencies": {
"babel-eslint": "^6.1.2",
"eslint": "^3.3.1",
"eslint-plugin-react": "^6.1.2",
"eslint-plugin-react-native": "^2.0.0",
"npm-watch": "^0.1.6"
}
}
The shell runs failed when build project within Release build configuration.
"./NYProject/node_modules/react-native/packager/react-native-xcode.sh"
Expected Results
Xcode could run shell when build the project. Before I upgrade the package.json configuration, it did run successfully.
Additional Information
React Native version:
react-native-cli: 0.2.0
react-native: 0.32.0
Platform(s) (iOS, Android, or both?):
Xcode 7.3.1 iOS
Operating System (macOS, Linux, or Windows?):
OS X 10.11

I had the same issue, and for me, simply upgrading to react-native 0.33.0 solved the problem.

Related

error Command failed with exit code 1 with react-native and Xcode library not found

I'm getting the following error when I clone react native project from github, yarn install, cd ios && pod install, cd .. , yarn ios . And/or when I ran react-native run-ios as well:
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
In addition, when I open the .xcworkspace in the Xcode, I get the error:
library not found for BugsnagReactNative
The package.json is:
{
"name": "proj",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"build": "CI= npm run build",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#bugsnag/react-native": "^7.16.2",
"#react-native-async-storage/async-storage": "^1.15.6",
"#react-native-community/checkbox": "^0.5.8",
"#react-native-community/datetimepicker": "^4.0.1",
"#react-native-community/masked-view": "^0.1.11",
"#react-native-community/netinfo": "^6.0.0",
"#react-navigation/bottom-tabs": "^6.0.5",
"#react-navigation/native": "^6.0.2",
"#react-navigation/stack": "^6.0.7",
"amazon-cognito-identity-js": "^5.1.0",
"aws-amplify": "^4.2.4",
"axios": "^0.21.1",
"package": "^1.0.1",
"prop-types": "^15.7.2",
"react": "17.0.2",
"react-native": "0.66.3",
"react-native-carousel": "^0.12.0",
"react-native-codegen": "^0.0.7",
"react-native-collapsible": "^1.6.0",
"react-native-date-picker": "^4.1.1",
"react-native-dropdown-picker": "^5.1.23",
"react-native-exit-app": "^1.1.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-mask-input": "^1.0.3",
"react-native-modal-dropdown": "^1.0.1",
"react-native-month-year-picker": "^1.8.0",
"react-native-safe-area-context": "^3.3.0",
"react-native-screens": "^3.13.1",
"react-native-select-dropdown": "^1.1.0",
"react-native-snap-carousel": "^3.9.1",
"tcomb-form-native": "^0.6.20",
"toggle-switch-react-native": "^3.2.0",
"yarn": "^1.22.17"
},
"devDependencies": {
"#babel/core": "^7.15.0",
"#babel/runtime": "^7.15.3",
"#bugsnag/source-maps": "^2.3.1",
"#react-native-community/eslint-config": "^3.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "26.6.3",
"eslint": "7.32.0",
"jest": "^27.0.6",
"metro-react-native-babel-preset": "^0.66.2",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
The solutions below I tried didn't work.
yarn add global #bugsnag/react-native-cli
change rct-folly deployment target to 9.0
set Build Active architecture Only to Yes
click and install ios 13.0 simulator in xcode
delete the search paths in build settings delete pods folder, and installed pods again
remove all lines in the 'Other Linker Flags' list BUT only if $(inherited) is at the top
pod update
reinstall ruby/gem
uninstall and reinstall Cocoapods
rm -rf node_modules, yarn cache clean
remove the podfile.lock and the pod, re-install them
sudo arch -x86_64 gem install ffi, arch -x86_64 pod install
uninstall and reinstall watchman
check node version, react native version, and bugsnag version
comment out bugsnag dependencies from package. json
fresh install multiple times
try this
npx #bugsnag/react-native-cli init
and check bugsnag documentation as you need to have a project available on bugsnag

react-native Unable to resolve module 'warnOnce'

my English is little rusty, I'm sorry for that.
I have an error at the moment when I am starting react-native project on the iOS Simulator.
To rule out any conflict with my code, I started a new project
react-native init demo
react-native start
react-native run-ios --simulator="iPhone 6"
Now is when i get the message error
Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `warnOnce` from `node_modules/react-native/Libraries/react-native/react-native-implementation.js`: warnOnce could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
at ModuleResolver.resolveDependency (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
at ResolutionRequest.resolveDependency (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
at Object.resolve (/usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/transformHelpers.js:267:42)
at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31
at Array.map (<anonymous>)
at resolveDependencies (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18)
at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
I need to know if anybody have same problem and how fix it ?
My react-native version is 0.61.5
package.json
{
"name": "demo",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.9.0",
"react-native": "0.61.4"
},
"devDependencies": {
"#babel/core": "^7.6.2",
"#babel/runtime": "^7.6.2",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
Thank you for advance.
I found the solution.
I was using react-native-cli.
An advice report in the last react-native documentation , inform that react-native-cli may cause unexpected issues.
I removed react-native-cli and now I'm using
npx react-native ...
Thank you and I'm sorry for my horrible English.
Try by editing the your metro.config.js to
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
])
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
Refer the thread and answer

Creating missing ios config caused "Application has not been registered error"

I'm trying to build a React Native project from another developer and he didn't commit the ios directory. Now I need to run the app on iOS and tried to use react-native upgrade to recreate the iOS config. When I run react-native run-ios after npm install, I'm getting "Application has not been registered error".
What do I have to change or what is the right way to recreate the iOS settings?
I'm running these commands on a MacOS High Sierra with Xcode 10.
Here's the package.json:
{
"name": "thefeedback-app",
"version": "1.0.0",
"description": "Project",
"main": "app.js",
"scripts": {
"start": "react-native start",
"postinstall": "node ./android-release-gradle-fix.js",
"clean":" #powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./preBuilding.ps1",
"android": "npm run clean && react-native run-android",
"ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js",
"bundle": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res"
},
"keywords": [
"react",
"native"
],
"license": "ISC",
"dependencies": {
"axios": "0.18.0",
"moment": "2.22.2",
"react": "16.4.0 ",
"react-native": "0.55.4",
"react-native-background-job": "2.1.1",
"react-native-easy-toast": "1.1.0",
"react-native-material-dropdown": "0.11.1",
"react-native-material-textfield": "0.12.0",
"react-native-onesignal": "3.2.5",
"react-native-push-notification": "3.0.2",
"react-native-sqlite-storage": "3.3.6",
"react-native-vector-icons": "4.6.0",
"react-navigation": "2.3.0",
"react-redux": "5.0.7",
"redux": "3.7.2",
"render-if": "0.1.1"
},
"devDependencies": {
"react-native-scripts": "1.14.1",
"react-test-renderer": "16.3.0-alpha.1"
}
}
The index.js:
import { AppRegistry } from 'react-native';
import App from './app/app';
import data from './app.json';
AppRegistry.registerComponent(data.displayName, () => App);
console.disableYellowBox = true;
And the app.json:
{
"expo": {
"sdkVersion": "25.0.0"
},
"name": "TheFeedbackApp",
"displayName": "TheFeedbackApp"
}
It seems that's something related to the name having a hyphen.

RNAppAuth, iOS build failed, Unknown type name 'namespace', react-native-app-auth

I am trying to add react-native-app-auth to existing, but quite fresh project with Expo.
I'm following your setup guide, so doing following steps:
yarn add react-native-app-auth#2.2.0 --dev
Add pod 'AppAuth', '>= 0.91'
cd iso && pod install
react-native link (EDIT: from root path of the project)
And I get:
rnpm-install info Linking react-native-app-auth ios dependency
rnpm-install WARN ERRGROUP Group 'Libraries' does not exist in your Xcode project. We have created it automatically for you.
rnpm-install info Platform 'ios' module react-native-app-auth has been successfully linked
which looks fine.
Then when I build in XCode i get the following error:
After searching the web I found it may be connected with compilator I changed it use Objective-C++:
and now I get more errors:
I also tried:
Changing Target version to 9.0
Doing it again
Praying 🙏
Nothing helps :( Xcode Version 9.3 (9E145)
app.js
{
"expo": {
"sdkVersion": "26.0.0",
"ios": {
"bundleIdentifier": "com.xxx.xxx",
"publishBundlePath": "ios/mobile-xxx/Supporting/shell-app.bundle",
"publishManifestPath": "ios/mobile-xxx/Supporting/shell-app-manifest.json"
},
"android": {
"package": "com.xxx.xxx"
},
"name": "mobile-xxx",
"slug": "mobile-xxx",
"version": "0.1.0",
"isDetached": true,
"entryPoint": "./index.js",
"detach": {
"scheme": "exp997ce9c6b4fd43cfa14f4eede063ecf5",
"iosExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/ios-v2.4.4-sdk26.0.0-3bd935c7-cdd3-4002-8e44-4df857a675f2.tar.gz",
"androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.4.0-sdk26.0.0-e63d9209-070c-4118-b06b-c60e82da0b66.tar.gz"
}
}
}
package.js
{
"name": "mobile-xxx",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "26.0.0",
"react-native-app-auth": "2.2.0",
"react-test-renderer": "16.3.0-alpha.1"
},
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^26.0.0",
"prop-types": "^15.6.1",
"react": "16.3.0-alpha.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz",
"react-native-app-auth": "^2.2.0",
"react-native-router-flux": "^4.0.0-beta.28",
"react-redux": "^5.0.7",
"redux": "^3.7.2"
}
}
UPDATE: I have just setup a fresh Expo app following this guide and have exactly the same error. 😞
The problem is that there is an import in header search paths, which searches in the whole /ios folder:
$(SRCROOT)/../../../ios/**
If you happen to use Expo and CocoaPods, there will be boost-for-react-native as a dependency inside your Pods folder. In fact, any package depending on boost will cause this problem. XCode tries to build boost as well, but it has some non-ObjC files, so it will fail.
In order to fix the issue:
Open RNAppAuth.xcodeproj, switch to Build Settings tab and search for header search paths. Replace line $(SRCROOT)/../../../ios/** with
"$(SRCROOT)/../../../ios/YOUR_PROJECT_NAME",
"$(SRCROOT)/../../../ios/Pods/AppAuth/**",
Please note that these changes will disappear after using npm install (or yarn). To make these changes permanent, you can use patch-package.
Edit: this issue has been fixed, using the latest version of the package should work now.

I can't test my app in iOS with Expo

I have some problems when i try to run my app on phones that have iOS, but in Android don't have this problem. I'm coding in Sublime Text, not in XDE and executing my project in terminal, with commands npm start and reading the QR Code. I'm coding in Windows 10.
I build the project with create-react-native-app
The erro that appears is
C:/Users/adria/Desktop/App/src/Imgs/image.png: Cannot find module
'C:/Users/adria/Desktop/App/node_moduless/expo/tools/hashAssetFiles'
In the first time i did think that image is with wrong name or wrong directory, and i go to the code and certify that is correctly. So, i resolve to try in my Android and for my surprise, work correctly.`
My project:
[https://snack.expo.io/HyKP1hyjz][1]
My package.json
{
"name": "App",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.11.1",
"jest-expo": "25.0.0",
"react-test-renderer": "16.2.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js" },
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^25.0.0",
"react": "16.2.0",
"react-native": "0.52.0",
"react-navigation": "^1.5.8"
}
}
I try to remove the image from my project and try run again, and have the same problem but with another image, from react-navigation
C:\Users\adria\Desktop\App\node_modules\react-navigation\src\views\assets\back-icon.png
You'll need to have the exponent package installed, see: https://github.com/expo/expo/issues/72

Resources