jest-preset-angular: ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/ts-jest-transformer' is not defined by "exports".
π Bug Report
To Reproduce
Steps to reproduce the behavior:
Just upgrade from jest-present-angular 8.3.1 to 9.0.1 and now I cannot run tests.
Expected behavior
The tests should run.
Link to repo (highly encouraged)
Error log:
# content of error stacktrace :
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/ts-jest-transformer' is not defined by "exports" in /home/x/
y/z/node_modules/ts-jest/package.json
at Object.<anonymous> (node_modules/jest-preset-angular/build/ng-jest-transformer.js:4:31)
envinfo
System:
OS: WSL2 - Debian
Npm packages:
jest: 27.0.3
jest-preset-angular: 9.0.1
typescript: 4.0.2
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20
Commits related to this issue
- fix: revert `exports` in `package.json` See https://github.com/thymikee/jest-preset-angular/issues/941#issuecomment-854580348 — committed to thymikee/jest-preset-angular by ahnpnl 3 years ago
- fix: revert `exports` in `package.json` See https://github.com/thymikee/jest-preset-angular/issues/941#issuecomment-854580348 — committed to thymikee/jest-preset-angular by ahnpnl 3 years ago
- fix: revert `exports` in `package.json` See https://github.com/thymikee/jest-preset-angular/issues/941#issuecomment-854580348 — committed to thymikee/jest-preset-angular by ahnpnl 3 years ago
- fix: revert `exports` in `package.json` See https://github.com/thymikee/jest-preset-angular/issues/941#issuecomment-854580348 — committed to thymikee/jest-preset-angular by ahnpnl 3 years ago
- fix: revert `exports` in `package.json` See https://github.com/thymikee/jest-preset-angular/issues/941#issuecomment-854580348 — committed to thymikee/jest-preset-angular by ahnpnl 3 years ago
- fix: revert `exports` in `package.json` (#948) See https://github.com/thymikee/jest-preset-angular/issues/941#issuecomment-854580348 — committed to thymikee/jest-preset-angular by ahnpnl 3 years ago
Node 12.20.0+ or 14.13.0+, see https://nodejs.org/api/packages.html#packages_subpath_patterns
I will bring this up to
ts-jest, seem like node at 12.20 is required.Strange that my work uses Node 12.14 can still run, probably cache on CI server.
Had the same issue - turned out to be node version problem - had run with Node v14.6. Hope that helps somebody.
Edit: switching to v14.16.x fixed it.
I have the same problem. After upgrading to the newest version, I get
Package subpath './dist/ts-jest-transformer' is not defined by "exports" in C:\Users\name\project\node_modules\ts-jest\package.json.Iβm using Windows & Angular 11.2.13, no nrwl.
As a temporary fix, I can change the content of
node_modules\ts-jest\package.jsonfrom:to
Then it works. So it seems like the wildcard export is not correctly resolved. But I donβt know why the example project works fine.
Spoiler: My Files
setup-jest.ts:package.json:tsconfig.spec.json:tsconfig.json: