wrapItem(...).trimStart in Expo and React native - react-native

Today I create a new project with create-react-native-app and after installing dependencies CRNA says to start your project with expo start, after running this command all thing seems good and a chrome open page localhost:19002 but after a minute this page is stoped and in the console it says :
[12:26:47] Starting project at D:\Try\eleventh
[12:27:13] Warning: Problem validating app.json: Unable to perform cache
refresh for C:\Users\Mohammad\AppData\Local\Expo\schema-30.0.0.json:
Error: connect ETIMEDOUT 35.202.142.166:443.
[12:27:39] Starting Metro Bundler on port 19001.
[12:27:39] Metro Bundler ready.
[12:27:40] Opening on Android device
[12:27:40] Successfully ran `adb reverse`. Localhost URLs should work on
the connected Android device.
[12:27:44] Tunnel ready.
[12:27:44] Expo DevTools is running at http://localhost:19002
[12:27:44] Opening DevTools in the browser... (press shift-d to disable)
exp://192.168.89.2:19000
To run the app with live reloading, choose one of:
[12:27:44] wrapItem(...).trimStart is not a function
[12:27:44] Set EXPO_DEBUG=true in your env to view the stack trace.
as you see it says :
wrapItem(...).trimStart is not a function
and this is some information may be useful :
create-react-native-app version: 2.0.2
node version: v8.11.3
expo version: 2.2.0
npm version: 6.4.0
yarn version:1.10.1

Try using a later version of node. I ran into this issue as well using node version 8. Bumping it with nvm to node 12 worked.

Related

npx expo start --tunnel : [ERR_UNKNOWN_ENCODING]: Unknown encoding: base64url

When trying to launch expo strart through an ngrok tunnel, I get the following error :
$ npx expo start --tunnel
Starting project at C:\Users\xxx\xxx\xxx
Starting Metro Bundler
CommandError: TypeError [ERR_UNKNOWN_ENCODING]: Unknown encoding: base64url
I am on Windows and I'm using expo sdk 46 at it's latest version and #expo/ngrok#^4.1.0. This error does not occur when trying to load npx expo start locally. Any idea why this may be happening?
base64url encoding was added in Node.js 16.0.0. Try upgrading Node if you are on an older version.

React Native: AwesomeProject not starting in emulator

I’m attempting to start up up the AwesomeProject basic project in react native, which is hanging when attempting to hit http://localhost:8081. 

Currently, the iOS emulator is starting up properly by running
yarn ios

After a short period of time, I’m met with the red error screen everyone loves stating “Could not connect to development server.

Here are the current tool versions.
Mac OS: 10.15.4 (macOS Catalina)
NodeJS: v10.19.0
yarn: 1.22.4
npm: 6.13.4
react-native cli: 3.2.1
react-native npm bundle: 0.61.4
expo: 3.15.5
expo npm bundle: 36.0.0
watchman: 4.9.0
xcode: 11.4 (11E146)

I’ve tried numerous ideas such as:
Trying to hit the 8081 url through the browser upon the emulator. I was able to hit the http url just fine
Tried to clear all caches, remove node_modules folder, etc
Ensured the OS firewall is disabled
Upgraded to the latest version of Node
As this point, I'm completely stuck lol and need to get this silly app working.
Can anyone here recommend some ideas?

Getting Building iOS bundle error when trying to build an android app - expo -react-native

I was able to build app using expo build:android previously. However, after upgrading to latest expo version I get following error:
connect ECONNREFUSED 127.0.0.1:19001
Set EXPO_DEBUG=true in your env to view the stack trace.
I also see the following lines in the log:
Publishing to channel 'default'...
Building iOS bundle
I don't added ios to my app.json, I only need to build an android apk. To do that I use expo build:android -t app-bundle
I also removed package-lock.json and node_modules and run npm install, but I get the same error.
I run expo start on another cmd and then run expo build:android -t app-bundle still get same error
Also when I clear expo cache, see the following log:
Restarting Metro Bundler...
Starting Metro Bundler on port 19001.
Couldn't adb reverse: adb.exe: error: Invalid source port: 'undefined'
I had faced same issue myself and found the solution. Expo is looking for localhost:19001 which is not running. Just follow following steps and it should work as expected:
Run expo start no terminal and once it opens up the
browser where you will find this line written Starting Metro
Bundler on port 19001.
Now open another terminal instance and run expo build:android.

"could not connect to development server" error running React Native tutorial with Expo, suspecting Watchman

New to react native and mobile dev, running into this problem:
I am running the React Native hello world from the Facebook Website using Expo CLI as the build tool. What I did was to install Expo, run expo init test, install cocoapods, and cd into the test directory and run expo start.
When I open the app on iOS simulator or my iPhone, I get "Could not connect to development server" after about 3-5 minutes in white screen (see screenshot).
In the Expo logs. It is notable that upon every startup I get the following error logs:
2019-08-25T21:49:21,474: [cli] Failed to open /Users/nsadeh/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Not a directory
ERROR
21:49
Watchman: watchman --no-pretty get-sockname returned with exit code=null, signal=SIGABRT, stderr= 2019-08-25T21:49:21,474: [cli] Failed to open /Users/nsadeh/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Not a directory
I have already tried un- and reinstalling Watchman as well as Expo. Not sure what else to do.
To reproduce:
macOS Mojave 10.14.6
node v10.16.3
expo 3.0.10
Watchman 4.9.0
react-native 0.59.10
Run expo init and from the top directory expo start.
Solution: turns out that postgreSQL left an unrelated LaunchAgents.plist file in my Library that was confusing Watchman. Renaming it resolved the issue.

Failed to load bundle - Could not connect to development server

I've been looking for a solution to this issue for a day now but couldn't fix it.
I have not used react native for a month when everything was working fine.
Now, if I try to run an existing project that used to work (react native 0.59.5) or a brand new project (react native 0.59.9) with the iOS simulator on my mac, I get the error:
Failed to load bundle - Could not connect to development server
Any idea how I can fix this?
Ok found the issue. Was thinking it might be watchman related issue and wanted to use the command brew reinstall watchmanto reinstall it. By running this command, I found an error
Error: Xcode alone is not sufficient on Mojave. Install the Command Line Tools: xcode-select --install
Looks like the command line tools for xCode was not available anymore.
I launched the command xcode-select --install and then reinstalled watchman just in case. It is now working!
Couldn't connect to development server error
This error is received when the metro bundler isn't running in port 8081. To start the bundler, from project folder run:
npm start
Now, try reloading your app (ctrl + R for iOS / r+r for Android).
Also, check your terminal in case the project failed initial build due to some error.