webdiscus/ansis

[BUG] 1.5.0 missing exports main

tomjn opened this issue · 10 comments

tomjn commented

Describe the bug

After updating my packages, Ansis 1.5 is pulled in and then fails with this message:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in XXXXXX/node_modules/ansis/package.json
> NODE_ENV=production webpack --config .config/webpack.config.prod.js

[webpack-cli] Failed to load 'XXXX/.config/webpack.config.prod.js' config
[webpack-cli] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in XXXX/node_modules/ansis/package.json
    at new NodeError (node:internal/errors:372:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:472:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:693:7)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (XXXX/node_modules/webpack-remove-empty-scripts/src/index.js:6:15) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
❯ npm explain ansis
ansis@1.5.0 devn
node_modules/ansis
  ansis@"^1.4.0" from webpack-remove-empty-scripts@0.8.3
  node_modules/webpack-remove-empty-scripts
    webpack-remove-empty-scripts@"^0.8.0" from @humanmade/webpack-helpers@1.0.0-beta.16
    node_modules/@humanmade/webpack-helpers
      dev @humanmade/webpack-helpers@"1.0.0-beta.16" from the root project

To Reproduce

Not clear at the moment if this is a universal issue or limited to a specific use case, only just encountered the problem

Expected behavior

I only became aware of the package when updating and encountering this message.

Dev Environment (please complete the following information):

  • OS: macOS Arm
  • Node 16.15.1

Additional context
Add any other context about the problem here.

tomjn commented

A similar issue reported on another package here: discordjs/discord-api-types#213

It's the second time this has happened (broken npm version) #2

Can confirm this is an issue for any dependent projects.

+1 that it is broken for all dependent projects as well.

The v1.5.0 is deprecated, use please last stable version 1.4.0.

I'm already looking for a problem.
It's strange, but v1.5.0 works without problems for me. MacOS, M1, Node.js 16.

P.S. Sometimes deleting the node_modules and package-lock.json helps.

@nicholasio @tstokes8040 @jayhill90 @tomjn

I'm very sorry :-(

In webpack-remove-empty-scripts v0.8.4 I have fixed the version of ansis in package.json (used exact last stable version "ansis": "1.4.0")

@webdiscus You're amazing!!!! Cheers!

@tomjn
thank you for the bug report.
I'm very sorry.
The webpack-remove-empty-scripts v0.8.4 contains exact last stable ansis v1.4.0.

The issue [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in node_modules/ansis/package.json is fixed in ansis v1.5.1.

The ansis v1.5.0 is deprecated.

Thanks for fixing this!