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

Module not found with Yarn 2 #360

Open
azuken opened this issue Feb 18, 2022 · 3 comments
Open

Module not found with Yarn 2 #360

azuken opened this issue Feb 18, 2022 · 3 comments

Comments

@azuken
Copy link

azuken commented Feb 18, 2022

Hi,

I'm trying to migrate my NextJS app with Yarn 2 (version 3.1.1) and PnP, but when app compile I've got an error which says next-session is not defined.
Stacktrace suggestion is to import /lib/session, but it doesn't work either.

Is there a reason why is does not work ?

Stacktrace :

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'next-session' imported from /Users/xxxxxx/.next/server/pages/_app.js
Did you mean to import next-session-npm-4.0.4-01166cd426-d602a2d75a.zip/node_modules/next-session/lib/session.cjs?
    at new NodeError (node:internal/errors:371:5)
    at packageResolve (node:internal/modules/esm/resolve:894:9)
    at moduleResolve (node:internal/modules/esm/resolve:940:18)
    at defaultResolve (node:internal/modules/esm/resolve:1043:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ESMLoader.import (node:internal/modules/esm/loader:332:22)
    at importModuleDynamically (node:internal/modules/cjs/loader:1036:29)
    at importModuleDynamicallyWrapper (node:internal/vm/module:437:21)
    at importModuleDynamically (node:vm:381:46)

@hoangvvo
Copy link
Owner

hoangvvo commented Feb 19, 2022

This seems related to hoangvvo/next-connect#163. Can you try the solution mentioned in that issue?

@azuken
Copy link
Author

azuken commented Feb 21, 2022

I will give a try to yarn canary version.

@Eli-Black-Work
Copy link

Yarn 3 has support for ESM modules.

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

No branches or pull requests

3 participants