-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[BUG] Platform-specific optional dependencies not being included in package-lock.json
when reinstalling with node_modules
present
#4828
Comments
node_modules
present
node_modules
presentpackage-lock.json
when reinstalling with node_modules
present
Sorry to ping you out of the blue, but this issue has been open for 11 days now without any movement. Is there anyone working on npm right now that might have the bandwidth to at least validate that this is indeed a problem as I've described it? Just so that when someone does become available to do some development work they know that this is in the queue? Please and thank you. |
Bump |
I'm also encountering this issue with a Next.js project:
Unfortunately developers often don't realise the Here is a reproduction:
|
I am also having this issue. I'm trying to run tests using jest with swc. The test runner is a linux image, but my dev machine is darwin. I can get it to work by either using --force to install the linux dependency, or I can install packages from inside the container... but github CI stands up the docker container in such a way that I can't easily install packages from in there, and that also prevents me from maintaining a cached node modules etc. |
bump |
bump - cannot get optional dependencies (namely |
bump |
Confirming that this issue is still present. It's particularly important for projects using NAPI modules, as tons of them use platform-specific packages. |
Ran into this issue when creating a CI process for a repo where I use a Windows machine and the CI process is using Linux. My quick "fix" for now is to start the CI process by deleting the package-lock.json and running npm install instead of npm ci. I know this is not good practice, so looking forward to a real fix to come through. |
bump |
I am having a similar issue. My project uses What has changed between v6 and v8 and is there an npm config option that will have v8 work similar to v6 when it comes to optional dependencies? |
Looks like there is a PR that tries to solve this issue, see #8077. Confirming with the author, so we might assist getting it ready for review. |
…n incompatible platform, to prevent issues when either the lockfile is removed
I looked into this issue and checked if #8077 would fix it. It doesn't seem that way. |
… pruning is skipped
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
This bug cause the issue: npm/cli#4828
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
There is a known bug with npm where optional dependencies aren't installed correctly, see: - npm/cli#4828 - rollup/rollup#5267 - vitejs/vite#15120 In order to resolve this we have to explicitly list the optional dependencies in our own package.json for them to be resolved and installed correctly.
- fix tests by adjusting snapshots for reify, now that it doesn't trash optional dependencies that fail due to a platform mismatch - fix tests for isolated-mode by adjusting the assertions to not expect failure, but expect an empty directory though in case of a platform mismatch
* feat!: Full ESM This makes Probot entirely esm-only. * Update various dependencies to their latest, ESM-only versions This updates pkg-conf at runtime, and get-port and execa in development * Run the linter * Update `@probot/octokit-plugin-config` * Update `@probot/octokit-plugin-config` again * fix: update octokit deps * fix: adapt for latest version of aggreagate-error * test: adapt for latest @octokit/webhooks * build: lockfile update * style: prettier * chore: bump `@probot/get-private-key` and `octokit-auth-probot` * chore(deps): use fetch-mock v10 * chore(deps): pkg-conf renamed to package-config * fix: define the `require()` function * style: prettier * build: lockfile update * Bump to stable @probot/get-private-key * build: downgrade `fetch-mock` This avoids a breaking change in 10.1 * build: package-lock update npm/cli#4828 * build: package-lock update npm/cli#4828 * fix: use import-meta-resolve to resolve the app functions * build(deps): unlock fetch-mock dependency * build: publish package to JSR (#2098) * fix(types): add explicit return types * build: publish package to JSR * style: prettier * build: update lockfile * style: lint * fix(build): split global type augmentation from module exports * build: package lock update * ci: run release for full-esm branch * build: fix release config * build: fix release config * style: prettier * build: update snapshots * Empty commit to triggerr release BREAKING CHANGE: Probot is now a fully ESM native library * replace lru-cache with toad-cache (#2108) * replace lru-cache with toad-cache * fix lint * update deps in package-lock * update deps in package-lock * probot14: Remove commander (#2132) * chore: remove commander * some more * better * dont throw * remove last elements of commander * fix * chore: optimize static files (#2134) * upgrade to probot pino v4 * build: package lock update --------- Co-authored-by: wolfy1339 <[email protected]> Co-authored-by: wolfy1339 <[email protected]> Co-authored-by: Aras Abbasi <[email protected]>
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I'm working on a team that utilizes a mix of x64-based and m1-based macs, and has CI build processes that uses musl. We're seeing that
npm
is skipping platform-specific optional dependencies for packages such as@swc/core
as a result of thepackage-lock.json
file being generated without all of them included. In our case, this then causes linting to throw an exception, because one of our eslint plugins depends on @swc, which depends on having the platform specific @swc package also installed.There seems to be at least two stages of cause to this. Firstly, when installing
@swc/core
from a clean slate working directorynpm
generates apackage-lock.json
with all of the optional dependencies for@swc/core
listed:And it only installs the platform specific package:
If I then remove my
package-lock.json
, leave mynode_modules
directory as-is, and then reinstall, I get:That is, it then generates a package-lock.json with only the platform-specific dependency that was installed on this machine, and not with the other optional dependencies that should also be listed.
If you delete both
node_modules
ANDpackage-lock.json
, and then re-runnpm install
, it generates the correct lockfile with all of those optional dependencies listed.The problem is that then, If the
package-lock.json
with the missing optional platform-specific dependencies gets checked into git and an x64 user pulls it down, or vice-versa,npm
fails to detect that your platform's optional dependencies are missing in the lockfile and just silently skips installing the platform-specific dependency. For example, when I've got a package-lock.json that only contains the x64 @swc package because of the above problem (generated by my coworker on his x64 machine):And I then install:
You can see that it fails to install the arm64 dependency or warn me in any way that the
package-lock.json
is missing my platform's dependency.So yeah, two problems:
Expected Behavior
npm
should preserve the full set of platform-specific optional deps for a package like @swc when rebuildingpackage-lock.json
from an existingnode_modules
treenpm install
should warn if thepackage-lock.json
becomes inconsistent because of the first caseSteps To Reproduce
See above.
Environment
The text was updated successfully, but these errors were encountered: