Skip to content

fix: dependency path is undefined #9013

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

Merged
merged 6 commits into from
Apr 12, 2025

Conversation

beyondkmp
Copy link
Collaborator

@beyondkmp beyondkmp commented Apr 7, 2025

fix #9011

Under the two package.json framework, if there are no node_modules in the app directory and npmRebuild is set to false, dependencies will not be reinstalled. As a result, npm list will return empty. In this case, we should attempt to retrieve the node_modules using the projectDir, which can resolve this issue.

Using getProjectRootPath directly from electron/rebuild is not accurate because it recursively searches upward level by level and returns the first match it finds. If I set the app directory outside the project dir, such as in another directory, the result returned by getProjectRootPath in electron/rebuild will be incorrect. Therefore, the projectDir should be passed in directly instead of searching upward level by level.
https://github.com/electron/rebuild/blob/ff1ec40f82ca64e014079b246053f039b3cf4f23/src/search-module.ts#L76-L86
image

Copy link

changeset-bot bot commented Apr 7, 2025

🦋 Changeset detected

Latest commit: 99af642

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
app-builder-lib Patch
electron-builder Patch
dmg-builder Patch
electron-builder-squirrel-windows Patch
electron-forge-maker-appimage Patch
electron-forge-maker-nsis-web Patch
electron-forge-maker-nsis Patch
electron-forge-maker-snap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@beyondkmp beyondkmp marked this pull request as draft April 7, 2025 03:05
@beyondkmp beyondkmp changed the title fix: Project dir fix: dependency path is undefined Apr 7, 2025
@beyondkmp beyondkmp marked this pull request as ready for review April 11, 2025 00:42
@beyondkmp beyondkmp requested review from mmaietta and Copilot April 11, 2025 00:42
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

@beyondkmp beyondkmp merged commit c223866 into electron-userland:master Apr 12, 2025
18 checks passed
@github-actions github-actions bot mentioned this pull request Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"dependency path is undefined" errors after upgrade to electron-builder 26
2 participants