expo icon indicating copy to clipboard operation
expo copied to clipboard

[expo-modules-core] ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING

Open yawnt opened this issue 11 months ago • 2 comments

Minimal reproducible example

https://gist.github.com/yawnt/06d7efd94298ec1bc8482d03085f4e24

What platform(s) does this occur on?

No response

Where did you reproduce the issue?

in Expo Go

Summary

I have a native module that loads expo-modules-core as part of its setup. Because expo-modules-core is published in Typescript, npx expo prebuild, npx expo doctor and other commands fail.

Environment

expo-env-info 1.3.3 environment info:
    System:
      OS: macOS 15.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 23.11.0 - /opt/homebrew/bin/node
      Yarn: 1.22.19 - /usr/local/bin/yarn
      npm: 10.9.2 - /opt/homebrew/bin/npm
      Watchman: 2025.04.28.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 24.4, iOS 18.4, macOS 15.4, tvOS 18.4, visionOS 2.4, watchOS 11.4
    IDEs:
      Xcode: 16.3/16E140 - /usr/bin/xcodebuild
    npmGlobalPackages:
      eas-cli: 13.4.1
    Expo Workflow: managed

Expo Doctor Diagnostics

Error [ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING]: Stripping types is currently unsupported for files under node_modules, for "~/Code/saffron/node_modules/expo-modules-core/src/index.ts"
(node:76687) ExperimentalWarning: Type Stripping is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

yawnt avatar May 06 '25 19:05 yawnt

Hi @yawnt! Thanks for reporting the issue. You are right that expo-modules-core is published as untranspiled TypeScript, it's mainly for Metro and React Compiler to perform optimizations based on the project setup.

I'm not sure why expo-modules-core is loaded during either expo prebuild or expo-doctor though. expo-modules-core is a library that was mainly built for React Native, and not Node. Can you share some reproducible steps on how to trigger that?


Keep in mind that expo-modules-core isn't a package that should be depend on directly. Instead, the expo package is tasked with setting this up properly. I'm not sure how you are setting it up in your own library?

byCedric avatar May 07 '25 10:05 byCedric

Hi,

Thanks for getting back to me. I am using https://github.com/deeeed/expo-audio-stream which seems to use quite a lot of classes from that package.

https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/deeeed/expo-audio-stream%24+expo-modules-core&patternType=keyword&sm=0

Does that mean that's wrong and I should open an issue on that repo?

yawnt avatar May 07 '25 12:05 yawnt

Hi,

I'm experiencing the same problem now. I also use this package https://www.npmjs.com/package/@siteed/expo-audio-studio?activeTab=readme I think it's just an updated version of what's @yawnt is using

This is an error that happens when I run npx expo prebuild or npx expo run

Error [ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING]: Stripping types is currently unsupported for files under node_modules, for "<path to expo prj>/node_modules/expo-modules-core/src/index.ts"
Error [ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING]: Stripping types is currently unsupported for files under node_modules, for "<path to expo prj>/node_modules/expo-modules-core/src/index.ts"
    at stripTypeScriptModuleTypes (node:internal/modules/typescript:186:11)
    at Module._compile (node:internal/modules/cjs/loader:1686:15)
    at Object.loadTS [as .ts] (node:internal/modules/cjs/loader:1826:10)
    at Module.load (node:internal/modules/cjs/loader:1469:32)
    at Module._load (node:internal/modules/cjs/loader:1286:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1491:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (<path to expo prj>/node_modules/@siteed/expo-audio-studio/build/cjs/ExpoAudioStreamModule.js:6:29)

@yawnt have you found a solution?

What's funny everything worked fine, I just deleted my node_modules folder by mistake and then did the npm install once again and keep getting this error.

deepnavy avatar May 10 '25 10:05 deepnavy

Clearly, the problem is in expo-audio-studio or stream package, because If you remove it from package.json everything works.

deepnavy avatar May 10 '25 11:05 deepnavy

#https://github.com/deeeed/expo-audio-stream/issues/237

deepnavy avatar May 10 '25 11:05 deepnavy

For me this happens when I reference expo-constants in the app.config.js

wildseansy avatar May 11 '25 03:05 wildseansy

Seems this was solved in the expo-audio-stream repo. Happy to close, although publishing Typescript code to NPM is indeed a bit strange.

yawnt avatar May 12 '25 08:05 yawnt

For me this happens when I reference expo-constants in the app.config.js

I had mistakenly added expo-constants to the plugins list in the app.config.js file. Removing it resolved the issue for me.

Thanks @wildseansy for the tip!

jwandrews avatar May 15 '25 19:05 jwandrews

Also happens in expo-print and expo-sharing :q

yarinsa avatar Jul 07 '25 11:07 yarinsa

I'm getting this error trying to install expo-web-browser

suschuk24 avatar Jul 20 '25 02:07 suschuk24

Also happens in expo-print and expo-sharing :q

I think I face the same problem, I am trying expo-print and expo-sharing, and this error happened haha. I still haven't found a solution for this. Do you have any solution?

sipamungkas avatar Jul 30 '25 02:07 sipamungkas

I solved this issue by removing expo-task-manager and expo-device from my app.json & project.

Unfortunately, I'm not sure which library caused it.

appaloosa-marketing avatar Sep 02 '25 16:09 appaloosa-marketing