question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No "exports" main resolved in @babel/helper-compilation-targets/package.json with Node 12.17.0

See original GitHub issue

Bug 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:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
MylesBorinscommented, May 26, 2020

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.

3reactions
smilingkitecommented, Jul 28, 2020

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’.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found