ERR_PACKAGE_PATH_NOT_EXPORTED : Package subpath './dist/pako.es5.js' is not defined by "exports"

590 Views Asked by At

I have an issue with the deployment of a node app to production. When I try to execute with Node a script I get the following error:


internal/modules/cjs/loader.js:498
  throw new ERR_PACKAGE_PATH_NOT_EXPORTED(basePath, mappingKey);
  ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/pako.es5.js' is not defined by "exports" in /opt/iul/sat_web_lfr/node_modules/pizzip/node_modules/pako/package.json
    at applyExports (internal/modules/cjs/loader.js:498:9)
    at resolveExports (internal/modules/cjs/loader.js:514:23)
    at Function.Module._findPath (internal/modules/cjs/loader.js:642:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1017:27)
    at Function.Module._load (internal/modules/cjs/loader.js:899:27)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (/opt/iul/sat_web_lfr/node_modules/pizzip/js/flate.js:5:12)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (/opt/iul/sat_web_lfr/node_modules/pizzip/js/compressions.js:14:19)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (/opt/iul/sat_web_lfr/node_modules/pizzip/js/utils.js:7:20) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

However when I execute this script on the testing server works fine. We even copy and paste the node modules folder from the testing server to the production server but the error is the same. I think is an error in some external package but I don't understand how the same configuration can have this kind of error depending on the system.

I've tried to update npm from 6.14.5 to 7.23.0 but the error persists. Both testing and production server uses the same version of Node, 14.X

The only possibility remaining is that I'm using a different NODE_ENV variable between the 2 servers but looking at the error message it's seems unlikely. Thanks in advance.

0

There are 0 best solutions below