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 error "Package jsdom can't be external" after upgrading to Next.js 15 #295

Closed
birdzai opened this issue Oct 22, 2024 · 4 comments
Closed

Comments

@birdzai
Copy link

birdzai commented Oct 22, 2024

I thought I would test out upgrading a project to the newly release Next.js V15 and when running the app I'm getting this error in the server logs:

⚠ ./node_modules/.pnpm/[email protected]/node_modules/isomorphic-dompurify
Package jsdom can't be external
The request jsdom matches serverExternalPackages (or the default list).
The request could not be resolved by Node.js from the project directory.
Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.
Try to install it into the project directory by running npm install jsdom from the project directory.

I of course followed the suggestion of manually installing jsdom into my node_modules folder, but I hadn't needed to do this before.

@birdzai birdzai changed the title Getting error "Package jsom can't be external" after upgrading to Next.js 15 Getting error "Package jsdom can't be external" after upgrading to Next.js 15 Oct 22, 2024
@kkomelin
Copy link
Owner

Hey @birdzai ,
Thanks for reporting. Did you try what's recommended in the message?

Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.
Try to install it into the project directory by running npm install jsdom from the project directory.

@birdzai
Copy link
Author

birdzai commented Oct 22, 2024

Yes, manually installing jsdom into node_modules fixed the error. I wasn't sure if you needed to be informed of having to perform this as something you cared about, so I thought I would raise it as an issue. Go ahead and close this issue if you think that's ok.

@kkomelin
Copy link
Owner

kkomelin commented Oct 22, 2024

Thanks @birdzai. We hadn't change much in this project since Next.js 14, so it's likely it's related to the latest Next.js update. But adding jsdom to external dependencies is a way to do it currently, though I understand that it's not very convenient #54 (comment)

@kkomelin
Copy link
Owner

Thanks again for reporting @birdzai !

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

2 participants