No "exports" main resolved in @babel/helper-compilation-targets/package.json with Node 12.17.0
See original GitHub issueBug Report
I know #11216 mentions a similar issue, but that is with Node 13, this is with the newly released 12.17.0.
Current behavior
Node just released 12.17.0 and now running "build": "babel src -d ./",
with the following deps (also installed the latest versions as well and still had the issue)
"@babel/cli": "^7.8.3",
"@babel/core": "^7.8.3",
results in:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in /Users/singleton/OSS/holocron/node_modules/@babel/helper-compilation-targets/package.json
at applyExports (internal/modules/cjs/loader.js:491:9)
at resolveExports (internal/modules/cjs/loader.js:507:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/singleton/OSS/holocron/node_modules/@babel/preset-env/lib/debug.js:8:33)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Input Code
"build": "babel src -d ./",
Expected behavior
It should build properly without error as it does on Node 12.16.3.
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
module.exports = function (api) {
api.cache(true);
return {
babelrcRoots: ['.', './packages/*'],
};
}
Environment
System:
OS: macOS Mojave 10.14.6
Binaries:
Node: 12.17.0 - ~/.nvm/versions/node/v12.17.0/bin/node
npm: 6.14.4 - ~/.nvm/versions/node/v12.17.0/bin/npm
Monorepos:
Lerna: 3.20.2
npmPackages:
@babel/cli: ^7.8.3 => 7.8.3
@babel/core: ^7.8.3 => 7.8.3
babel-preset-amex: ^2.1.0 => 2.2.0
eslint: ^6.8.0 => 6.8.0
jest: ^25.1.0 => 25.1.0
lerna: ^3.20.2 => 3.20.2
Additional context It works fine on Node 12.16.3.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:10 (4 by maintainers)
Top Results From Across the Web
No "exports" main resolved in /app/node_modules/@babel ...
For, example, using node 12.22.0 worked, as well as 14.17.4. Note that node version of 13.x will not work at all.
Read more >Upgrade babel dependencies (yarn run build:js broken) - Drupal
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in core/node_modules/@babel/helper-compilation-targets/package.json ...
Read more >No "exports" main defined - Laracasts
Hello , After cloning my project I got the error bellow when I npm run watch (I deleted the node_modules) ERROR in ./resources/js/app.js...
Read more >Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No 'exports'
The npm update command will update the installed modules that have fuzzy versioning. package path not exported error. Open your terminal in your...
Read more >Using Node.js to code OpenWhisk actions - IBM
Develop the action as an NPM module, declaring meta-data and dependencies in package.json as usual · Expose the action entry point as an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks like the issue was an out of date version of helper-compilation-target in the package-lock. I’ve opened a PR that should fix this.
https://github.com/americanexpress/holocron/pull/35
Once that has confirmed to fix stuff I think this issue can be closed.
For people trying to deal with this one: I had to not only delete the lock file, but also delete the whole node-modules directory (though deleting the specific package would probably have worked as well).
THEN do an ‘npm install’.