gulp-terser icon indicating copy to clipboard operation
gulp-terser copied to clipboard

[Question] No valid exports main exception

Open haganbt opened this issue 3 years ago • 2 comments

Apologies if this is a very simple solution! Just starting out with gulp. When I run the how to use example, I get the following exception:

Error: No valid exports main found for '----/node_modules/terser'
    at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)
    at applyExports (internal/modules/cjs/loader.js:502:14)
    at resolveExports (internal/modules/cjs/loader.js:551:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)
    at Function.Module._load (internal/modules/cjs/loader.js:855:27)
    at Module.require (internal/modules/cjs/loader.js:1033:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (------/node_modules/gulp-terser/lib/index.js:7:38)
    at Module._compile (internal/modules/cjs/loader.js:1144:30) {
  code: 'MODULE_NOT_FOUND'

Can anyone advise whats causing this?

node v13.6.0

haganbt avatar Aug 05 '20 19:08 haganbt

Apologies if this is a very simple solution! Just starting out with gulp. When I run the how to use example, I get the following exception:

Error: No valid exports main found for '----/node_modules/terser'
    at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)
    at applyExports (internal/modules/cjs/loader.js:502:14)
    at resolveExports (internal/modules/cjs/loader.js:551:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)
    at Function.Module._load (internal/modules/cjs/loader.js:855:27)
    at Module.require (internal/modules/cjs/loader.js:1033:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (------/node_modules/gulp-terser/lib/index.js:7:38)
    at Module._compile (internal/modules/cjs/loader.js:1144:30) {
  code: 'MODULE_NOT_FOUND'

Can anyone advise whats causing this?

node v13.6.0

Can you provide a demo for me to test?

duan602728596 avatar Aug 06 '20 04:08 duan602728596

I was seeing the same error, so I upgraded to node v14.12.0 and now it works.

BTW gulp-terser is great, thanks a lot 👍

mckenfra avatar Sep 28 '20 22:09 mckenfra