Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting ERR_PACKAGE_PATH_NOT_EXPORTED error in monorepo when updating to Node 16 #1550

Closed
joshdura opened this issue Aug 24, 2022 · 6 comments
Labels

Comments

@joshdura
Copy link

I am running a serverless application in a yarn workspaces monorepo. When trying to run the serverless offline command after updating to Node 16 (from Node 12), I get the following error:

Environment: linux, node 16.17.0, framework 3.17.0 (local), plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues
emr-services    |
Error:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/debugLog' is not defined by "exports" in /source/node_modules/serverless-offline/package.json
    at new NodeError (node:internal/errors:387:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:464:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:748:3)
    at resolveExports (node:internal/modules/cjs/loader:493:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:533:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/source/node_modules/serverless-offline-sqs/src/index.js:15:18)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at module.exports (/source/node_modules/serverless/lib/utils/import-module.js:5:12)
    at PluginManager.requireServicePlugin (/source/node_modules/serverless/lib/classes/plugin-manager.js:171:14)
    at PluginManager.resolveServicePlugins (/source/node_modules/serverless/lib/classes/plugin-manager.js:198:29)
    at async PluginManager.loadAllPlugins (/source/node_modules/serverless/lib/classes/plugin-manager.js:136:36)
    at async Serverless.init (/source/node_modules/serverless/lib/serverless.js:141:5)
    at async /source/node_modules/serverless/scripts/serverless.js:591:7
npm ERR! Lifecycle script `start` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: emr-services@1.1.703
npm ERR!   at location: /source/packages/emr-services

The start script in my package.json file is as follows:

"start": "SLSDEBUG=* serverless offline",

Serverless versions here:

"serverless": "^3.2.1",
"serverless-domain-manager": "^5.1.0",
"serverless-offline": "9.2.6",
"serverless-offline-sqs": "^6.0.0",
"serverless-plugin-chrome": "^1.0.0-55.3",
"serverless-plugin-lambda-insights": "^1.0.10",
"serverless-plugin-split-stacks": "^1.11.0",
"serverless-prune-plugin": "^1.5.0",
"serverless-webpack": "^5.7.1",

Any idea what might be causing this (or any possible workarounds)? I have tried a complete reinstall via yarn as has been suggested in other articles I have read on this issue, but it doesn't work.

@joshdura
Copy link
Author

One other note, just went back down a version (to 8.x) and this issue doesn't happen.

@an1va
Copy link

an1va commented Aug 24, 2022

Seeing the same issue on Node16. Was trying to switch to top level awaits but can't seem to go serverless-offline-9.x to start using this feature. Everything worked fine on serverless-offline-8.8, but that doesn't support top level await yet.

@dnalborczyk
Copy link
Collaborator

dnalborczyk commented Aug 24, 2022

@joshdura @an1va

that's really weird. ./dist does not exist anymore in v9, which was the Babel compiler target in v8.

you might want to try some equivalent of npm update (yarn update?) or remove node_modules and yarn lock and force a fresh install.

if that doesn't help try to see if you have multiple versions of serverless-offline installed (since you mentioned monorepo).

if none of this helps I would like to ask you to create a really simple repro repository, but I don't think it will be needed.

@joshdura
Copy link
Author

Figured it out, it's actually an issue in the serverless-offline-sqs package. Linked here.

@dnalborczyk
Copy link
Collaborator

thanks for linking the issue @joshdura

in addition: rubenkaiser/serverless-offline-eventBridge#60

@rubenkaiser
Copy link

#1552

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants