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

fix: handle npm v7 overwriting node_modules symlink #636

Merged
merged 7 commits into from
Dec 2, 2022

Conversation

danielroe
Copy link
Member

context: #633

The issue was that npm v7 (enabled in @vercel/build-utils v2.12.0 by vercel/vercel#6532) apparently refuses to install into a symlinked node_modules folder so dev dependencies were being added to the lambda.

This PR re-upgrades to the latest build-utils and adds a workaround for this npm behaviour.

@danielroe danielroe requested a review from pi0 November 23, 2022 11:34
const stats = await fs.stat(modulesPath)
if (stats.isDirectory()) {
await fs.rm(namespacedPath, { force: true, recursive: true })
await fs.move(modulesPath, namespacedPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perf: Can we make these two in parallel?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so - we need to remove the directory before moving a new directory into its place

@danielroe danielroe merged commit ff20a34 into main Dec 2, 2022
@danielroe danielroe deleted the fix/support-npm-v7 branch December 2, 2022 23:02
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

Successfully merging this pull request may close these issues.

2 participants