Skip to content
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

Expo prebuild error which can not create the android and ios folder. #28964

Open
deadislove opened this issue May 18, 2024 · 6 comments
Open
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@deadislove
Copy link

Minimal reproducible example

https://github.com/deadislove/00-login-expo

What platform(s) does this occur on?

Android

Did you reproduce this issue in a development build?

Yes

Summary

I want to do the initial project operation and use the expo cli to implement the prebuild project operation, but the cli result shows the error messages which messages below:

$ expo prebuild
(node:5632) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Could not parse JSON returned from "npm view expo-template-bare-minimum@sdk-51 dist.tarball --json".

https://registry.npmjs.org/expo-template-bare-minimum/-/expo-template-bare-minimum-51.0.27.tgz

Error: Unexpected token 'h', "https://re"... is not valid JSON
× Failed to create the native directory
You may want to delete the ./ios and/or ./android directories before trying again.

The older Expo SDK doesn't show it, but I can't ensure it is related to the new Node JS version. Can someone tell me how to fix it? I tried installing the package and cleaning the cache, but it didn't fix it. Please tell me the temporary solution if it concerns the SDK issues.

My laptop environment:

‵``
$ npm -g list
C:\Users\keyph\AppData\Roaming\npm
├── @angular/cli@17.3.7
├── @vue/cli-service-global@4.5.19
├── @vue/cli@5.0.8
├── eas-cli@9.0.6
├── expo@51.0.5
├── firebase-tools@13.9.0
├── node-gyp@10.1.0
├── npm@10.8.0
├── react-native-cli@2.0.1
├── react-native@0.74.1
└── typescript@5.4.5



### Environment

$ npx expo-env-info
Need to install the following packages:
expo-env-info@1.2.0
Ok to proceed? (y) y

expo-env-info 1.2.0 environment info:
System:
OS: Windows 11 10.0.22621
Binaries:
Node: 22.2.0 - C:\Program Files\nodejs\node.EXE
npm: 10.8.0 - ~\AppData\Roaming\npm\npm.CMD
SDKs:
Android SDK:
API Levels: 30, 31, 32, 33, 33, 33
Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0, 33.0.1, 33.0.2
System Images: android-31 | Intel x86_64 Atom, android-31 | Google APIs Intel x86_64 Atom, android-31 | Google Play Intel x86_64 Atom, android-33-ext4 | Google Play Intel x86_64 Atom, android-33-ext5 | Google Play Intel x86_64 Atom, android-33 | Google APIs ARM 64 v8a, android-33 | Google APIs Intel x86_64 Atom, android-33 | Google Play Intel x86_64 Atom
IDEs:
Android Studio: AI-223.8836.35.2231.10671973
npmPackages:
expo: ~51.0.7 => 51.0.8
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
react-native-web: ~0.19.10 => 0.19.11
Expo Workflow: managed


### Expo Doctor Diagnostics

$ npx expo-doctor@latest
Need to install the following packages:
expo-doctor@1.6.1
Ok to proceed? (y) y

(node:28164) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
WARNING: We recommend using PowerShell or Bash via WSL 2 for development with Expo CLI on Windows. You may encounter issues using cmd.exe.

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check native tooling versions
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check for issues with metro config
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK

Didn't find any issues with the project!

@deadislove deadislove added the needs validation Issue needs to be validated label May 18, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 18, 2024
@kadikraman
Copy link
Contributor

Hi @deadislove I was talking to someone else who had the same issue as you, and the root cause was the node version. Can you try downgrading to node@20? I'm on v20.12.0 but I think any 20.x version should work.

I think there may be some kind of breaking change in v22 that causes this issue. The Expo framework isn't tested on node@v22, so for now the best version to use is still node@v20.

@deadislove
Copy link
Author

deadislove commented May 20, 2024

Hi @deadislove I was talking to someone else who had the same issue as you, and the root cause was the node version. Can you try downgrading to node@20? I'm on v20.12.0 but I think any 20.x version should work.

I think there may be some kind of breaking change in v22 that causes this issue. The Expo framework isn't tested on node@v22, so for now the best version to use is still node@v20.

Hi @kadikraman
I tried it, and it worked, but I have another question. Will the NodeJS and Expo versions affect the Auth0 package? I tried to use the older versions of NodeJS and Expo, but I found out that Auth0's getCredentials function always responds with an undefined value, so I updated my Expo and NodeJS.

@achou11
Copy link

achou11 commented May 21, 2024

I ran into this issue because I updated my global npm version to v10.8 (still using node v20). Downgrading npm back to what I had before (v10.6) fixed the issue for me.

In case it's helpful to understand the default npm version associated with specific node versions: https://nodejs.org/en/about/previous-releases#looking-for-latest-release-of-a-version-branch

@itamarbareket
Copy link

itamarbareket commented May 21, 2024

Downgrading to npm@10.6.0 solves it for now.


❯ npm view --json expo-template-bare-minimum@sdk-50 dist.tarball
https://registry.npmjs.org/expo-template-bare-minimum/-/expo-template-bare-minimum-50.0.43.tgz

❯ npm --version
10.8.0

❯ npm i -g npm@10.6.0

removed 1 package, and changed 57 packages in 2s

24 packages are looking for funding
  run `npm fund` for details

❯ npm --version      
10.6.0

❯ npm view expo-template-bare-minimum@sdk-50 dist.tarball --json
"https://registry.npmjs.org/expo-template-bare-minimum/-/expo-template-bare-minimum-50.0.43.tgz"

NPM 10.8.0 is not returning a valid JSON

Related NPM bug: npm/cli#7537

@madmeatballs
Copy link

Downgrading to npm@10.6.0 solves it for now.


❯ npm view --json expo-template-bare-minimum@sdk-50 dist.tarball
https://registry.npmjs.org/expo-template-bare-minimum/-/expo-template-bare-minimum-50.0.43.tgz

❯ npm --version
10.8.0

❯ npm i -g npm@10.6.0

removed 1 package, and changed 57 packages in 2s

24 packages are looking for funding
  run `npm fund` for details

❯ npm --version      
10.6.0

❯ npm view expo-template-bare-minimum@sdk-50 dist.tarball --json
"https://registry.npmjs.org/expo-template-bare-minimum/-/expo-template-bare-minimum-50.0.43.tgz"

NPM 10.8.0 is not returning a valid JSON

Related NPM bug: npm/cli#7537

This works if ever someone else also encounters this.

@itamarbareket
Copy link

itamarbareket commented May 30, 2024

npm@10.8.1 is out now with the bugfix, this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

6 participants