You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeORM should work just fine with RN and Node 14+ (since Node12 will eventually be retired)
Actual Behavior
Since Node 14+ all files that are meant to be accessed from third-parties need to be declared in the package.json "export" field. Current configuration is mostly fine, but React Native also reads the package.json. Since this field is not specified the react native packager is not able to link the package and it fails the import on runtime.
I've locally fixed the issue in my node_modules by changing:
"./package.json": "./package.json", // <-- added this line on typeorm package.json exports field"./*.js": "./*.js",
Steps to Reproduce
On any react-native project using a node 14+ version trying installing typeorm
try running the app, there will be a package.json.js file not found:
warn Package typeorm has been ignored because it contains invalid configuration. Reason: Cannot find module '/Users/osp/Developer/quick-sqlite/example/node_modules/typeorm/package.json.js'
My Environment
Dependency
Version
Operating System
macos
Node.js version
16.14.2
TypeORM version
0.3.7
Additional Context
Relevant Database Driver(s)
DB Type
Reproducible
aurora-mysql
no
aurora-postgres
no
better-sqlite3
no
cockroachdb
no
cordova
no
expo
no
mongodb
no
mysql
no
nativescript
no
oracle
no
postgres
no
react-native
yes
sap
no
spanner
no
sqlite
no
sqlite-abstract
no
sqljs
no
sqlserver
no
Are you willing to resolve this issue by submitting a Pull Request?
✖️ Yes, I have the time, and I know how to start.
✖️ Yes, I have the time, but I don't know how to start. I would need guidance.
✖️ No, I don’t have the time, but I can support (using donations) development.
✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
The text was updated successfully, but these errors were encountered:
Invalid `Podfile` file: 767: unexpected token at 'Error: Cannot find module 'xxxxx/node_modules/typeorm/package.json.js'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15)
at resolveExports (node:internal/modules/cjs/loader:482:14)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at resolveNodeModuleDir (xxxxx/node_modules/@react-native-community/cli-tools/build/resolveNodeModuleDir.js:24:42)
at xxxxx/node_modules/@react-native-community/cli-config/build/loadConfig.js:93:76
at Array.reduce (<anonymous>)
at loadConfig (xxxxx/node_modules/@react-native-community/cli-config/build/loadConfig.js:91:134)
Issue Description
Expected Behavior
TypeORM should work just fine with RN and Node 14+ (since Node12 will eventually be retired)
Actual Behavior
Since Node 14+ all files that are meant to be accessed from third-parties need to be declared in the
package.json
"export" field. Current configuration is mostly fine, but React Native also reads the package.json. Since this field is not specified the react native packager is not able to link the package and it fails the import on runtime.You can see a more detailed issue here:
react-native-community/cli#1168
I've locally fixed the issue in my node_modules by changing:
Steps to Reproduce
My Environment
Additional Context
Relevant Database Driver(s)
aurora-mysql
aurora-postgres
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
spanner
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: