eas-cli icon indicating copy to clipboard operation
eas-cli copied to clipboard

Failed to construct transformer: Error: Cannot parse /home/expo/.nvm/test/fast/Unit tests/mocks/project_dirs/nested-both/package.json as JSON: Unexpected end of JSON input

Open pencilcheck opened this issue 1 year ago • 2 comments

Build/Submit details page URL

https://expo.dev/accounts/pencilcheck/projects/plushie-hellheim/builds/e12ed968-282a-4b5f-9eee-ea46f7873400

Summary

I already tried the expo doctor and npx expo install --check once, but it still give the same error. It was working with the old dependencies. I don't know why once I do 1) add local credentials to eas.json 2) and install react-native-iap, this issue started to happen on a new bundle identifier.

I also seen some suggested monorepo issue, but mine is not a monorepo.

Basically it used to build, but now it is showing this error.

BTW, I can eas build locally. This is a expo remote env issue. I have a feeling it has something to do with nvm. but i'm not sure.

ALSO, I tried development env and it worked, with the same code (perhaps the real issue is the lack of developmentClient?)

Actually I just tested by adding developmentClient to preview and it worked

    "development": {
      "node": "21.5.0",
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "resourceClass": "m-medium"
      },
      "android": {
        "image": "ubuntu-22.04-jdk-11-ndk-r21e"
      },
      "env": {
        "APP_VARIANT": "development"
      }
    },
    "preview": {
      "node": "21.5.0",
      "distribution": "internal",
      "ios": {
        "simulator": true,
        "resourceClass": "m-medium"
      },
      "android": {
        "image": "ubuntu-22.04-jdk-11-ndk-r21e"
      },
      "env": {
        "APP_VARIANT": "preview",
        "SERVER_URL": "https://replace-with-heroku-url"
      }
    },

For some reason anything other than development wouldn't work, I used "preview" and "production" and none of them worked.

Managed or bare?

bare

Environment

Need to install the following packages:
[email protected]
Ok to proceed? (y) y

  expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.2.1
      Shell: 3.6.4 - /opt/homebrew/bin/fish
    Binaries:
      Node: 21.5.0 - ~/.nvm/versions/node/v21.5.0/bin/node
      Yarn: 1.22.19 - ~/.nvm/versions/node/v21.5.0/bin/yarn
      npm: 10.2.4 - ~/.nvm/versions/node/v21.5.0/bin/npm
      Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.14.3 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
      Android SDK:
        API Levels: 30, 32, 33, 33
        Build Tools: 30.0.2, 30.0.3, 33.0.0, 33.0.2, 34.0.0
        System Images: android-29 | Google Play ARM 64 v8a, android-30 | Google Play ARM 64 v8a, android-30 | Google Play Intel x86_64 Atom, android-31 | Google Play ARM 64 v8a, android-33 | Google Play ARM 64 v8a, android-33 | Google Play Intel x86_64 Atom, android-UpsideDownCake | Google Play ARM 64 v8a
    IDEs:
      Android Studio: 2021.2 AI-212.5712.43.2112.8609683
      Xcode: 15.2/15C500b - /usr/bin/xcodebuild
    npmPackages:
      @expo/metro-config: ~0.10.0 => 0.10.7
      expo: 49 => 49.0.21
      expo-router: ^2.0.0 => 2.0.14
      react: 18.2.0 => 18.2.0
      react-dom: 18.2.0 => 18.2.0
      react-native: 0.72.6 => 0.72.6
      react-native-web: ~0.19.6 => 0.19.10
    Expo Workflow: managed
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
(node:96320) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for issues with metro config
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✖ Check that packages match versions required by installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✖ Check that native modules use compatible support package versions for installed Expo SDK

Detailed check results:

Expected package @expo/config-plugins@~7.2.2
Found invalid:
  @expo/[email protected]
  (for more info, run: npm why @expo/config-plugins)
Advice: Upgrade dependencies that are using the invalid package versions0.

(node:96470) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Some dependencies are incompatible with the installed expo version:
  [email protected] - expected version: 0.72.10
  @expo/[email protected] - expected version: ~7.2.2
  @types/[email protected] - expected version: ~18.2.14
  [email protected] - expected version: ^5.1.3
Your project may not work correctly until you install the correct versions of the packages.
Fix with: npx expo install --fix
Found outdated dependencies
Advice: Use 'npx expo install --check' to review and upgrade your dependencies.

One or more checks failed, indicating possible issues with the project.

Error output

Failed to construct transformer:  Error: Cannot parse /home/expo/.nvm/test/fast/Unit tests/mocks/project_dirs/nested-both/package.json as JSON: Unexpected end of JSON input
    at Object.worker (/home/expo/workingdir/build/node_modules/metro-file-map/src/worker.js:80:13)
    at execFunction (/home/expo/workingdir/build/node_modules/jest-worker/build/workers/processChild.js:137:17)
    at execHelper (/home/expo/workingdir/build/node_modules/jest-worker/build/workers/processChild.js:116:5)
    at execMethod (/home/expo/workingdir/build/node_modules/jest-worker/build/workers/processChild.js:120:5)
    at process.messageListener (/home/expo/workingdir/build/node_modules/jest-worker/build/workers/processChild.js:38:7)
    at process.emit (node:events:519:28)
    at emit (node:internal/child_process:951:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
  type: 'Error'
}

Reproducible demo or steps to reproduce from a blank project

I don't know how to reproduce it with a small project since I have a lot of dependencies and project sensitive configuration.

pencilcheck avatar Feb 16 '24 15:02 pencilcheck

Hi, it's harder for me to help you without the repro 🤔.

I can't see anything that the EAS Build process is doing that could be responsible for this issue occurring for you (at least for now) 🤔.

I can eas build locally

Did you check that the versions of the tools on the image that you are using match the versions that you have installed locally?

szdziedzic avatar Feb 19 '24 17:02 szdziedzic

I set the version of the tools in package.json and also having yarn.lock files, the version shouldn't be different

pencilcheck avatar Mar 11 '24 23:03 pencilcheck