cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] `npm ci` not working after successful `npm install`

Open jakehockey10 opened this issue 1 month ago • 10 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

This issue exists in the latest npm version

  • [x] I am using the latest npm

Current Behavior

When I run npm install I successful install my project's dependencies. When I run npm ci afterwards, I get an error:

$ npm ci
npm error code EBADPLATFORM
npm error notsup Unsupported platform for [email protected]: wanted {"cpu":"!arm,!arm64,!riscv64,!x64"} (current: {"cpu":"x64"})
npm error notsup Valid cpu:  !arm,!arm64,!riscv64,!x64
npm error notsup Actual cpu: x64
npm error A complete log of this run can be found in: /home/jake/.npm/_logs/2025-11-25T00_29_19_394Z-debug-0.log

I initially thought this was an issue with sass-embedded, but I've since learned that this is likely a bug with npm itself: https://github.com/sass/embedded-host-node/issues/404

I would like to continue using npm ci in my ci pipelines if that is still the suggested method (which makes sense to me based on recent descriptions I've received), but until this is resolved, I will need to use npm install directly with my CI pipelines. I'm not sure why the optional dependency is not treated as such when using the npm ci command.

Expected Behavior

Running npm ci after a successful npm install should not error out.

Steps To Reproduce

No response

Environment

  • npm:
  • Node.js:
  • OS Name:
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here

jakehockey10 avatar Nov 25 '25 01:11 jakehockey10

This issue is resolved by downgrading npm to 10 instead of 11.

jakehockey10 avatar Nov 25 '25 01:11 jakehockey10

@jakehockey10 , can you try replicating this problem on the latest version of npm? (ie. npm i -g npm). If you find that the issue is reoccurring please provide more details such as package.json, npm config and steps to reproduce.

MRagunandhan24 avatar Nov 27 '25 18:11 MRagunandhan24

Sorry if this wasn't clear, but I was using the latest version of npm when this error occurred. The work around seems to be downgrading a full major version to 10, but that is the workaround, not where I'm getting the error. Please let me know if I am misunderstanding you in any way.

jakehockey10 avatar Nov 29 '25 18:11 jakehockey10

seems (to me) very similar to #8726? I'm able to see this happening from dependabot

TobiTenno avatar Dec 01 '25 01:12 TobiTenno

@TobiTenno I have also been experiencing that for a while now too. My workaround has been to submit my PR, get npm ci to fail in CI, then go back to my local repo and delete node_modules and package-lock.json, run npm install again and commit any changes that come out of that. That was working for a while, but I agree that npm i and npm ci were both out of sync with each other. However, this is an outright error that I'm getting because "something" is misunderstanding my platform all of the sudden. It may be related, but I'm not sure this is a duplicate of #8726 . That's just my two sense, but I've never understood how npm works enough to speak confidently on what's going on with it, ever.

jakehockey10 avatar Dec 01 '25 17:12 jakehockey10

Some additional information: If I go back to NPM 11 and run npm install twice in a row, the following happens:

  • first run package-lock.json shows up with changes
  • second run package-lock.json no longer has changes

npm ci on CI will claim that my package.json and package-lock.json are out of sync.

INSTEAD, if I run npm install one time, get a package-lock.json file to show changes in git, commit those changes, and then watch the CI pipeline, I'm back to the original error I reported in this ticket.

Changing my CI pipeline to just use npm install is a workaround for this. But it feels like I'm just ignoring the problem and not getting what I want to get out of npm ci and why it exists in the first place.

jakehockey10 avatar Dec 01 '25 18:12 jakehockey10

I don't see the exact version used anywhere in this issue.

Please use npm >= 11.6.3 to generate package-lock and when installing in CI. See problems with lower versions.

liamcmitchell avatar Dec 08 '25 15:12 liamcmitchell

I'm sorry for not specifying in the ticket the exact version. I've seen the issue on 11.6.3 and 11.6.4.

I promise you, using the latest npm is not solving the issue. Completely ignoring and not using the npm ci command is my only workaround

jakehockey10 avatar Dec 08 '25 16:12 jakehockey10

OK, sorry that didn't help.

It would be helpful for anyone else looking into this if you can specify the exact version and provide minimal reproduction steps in the description.

liamcmitchell avatar Dec 08 '25 17:12 liamcmitchell

@liamcmitchell thanks for the response. I was able to reproduce the issue. I created a new project, added DevExtreme, as well as a few other dependencies. I then deleted my package-lock.json file and node_modules folder, ran npm install and then npm ci and was able to reproduce the problem. To re-iterate, after using the Angular CLI to create the project and adding the dependencies, npm ci was working fine. Only after I deleted the package-lock.json and node_modules folders entirely and re-installing using npm install did the issue start happening again.

Please let me know what else I need to share in terms of reproduction, and I'll be happy to. For now, here is what I think is necessary to reproduce this:

$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    


Angular CLI: 20.3.13
Node: 22.21.1
Package Manager: npm 11.6.4
OS: linux x64
    

Angular: 20.3.15
... common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                      Version
------------------------------------
@angular-devkit/architect    0.2003.13
@angular-devkit/core         20.3.13
@angular-devkit/schematics   20.3.13
@angular/build               20.3.13
@angular/cli                 20.3.13
@schematics/angular          20.3.13
rxjs                         7.8.2
typescript                   5.9.3

$ npm -v
11.6.4

$ node -v
v22.21.1

$ cat package.json
{
  "name": "delete-me",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "lint": "ng lint",
    "build-themes": "devextreme build",
    "postinstall": "npm run build-themes"
  },
  "prettier": {
    "printWidth": 100,
    "singleQuote": true,
    "overrides": [
      {
        "files": "*.html",
        "options": {
          "parser": "angular"
        }
      }
    ]
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^20.3.0",
    "@angular/compiler": "^20.3.0",
    "@angular/core": "^20.3.0",
    "@angular/forms": "^20.3.0",
    "@angular/platform-browser": "^20.3.0",
    "@angular/router": "^20.3.0",
    "@fingerprintjs/fingerprintjs-pro-angular": "^2.1.0",
    "devextreme": "^25.1.7",
    "devextreme-angular": "^25.1.7",
    "devextreme-exceljs-fork": "^4.4.4",
    "devextreme-schematics": "^1.12.2",
    "file-saver-es": "^2.0.5",
    "jspdf": "^3.0.4",
    "libphonenumber-js": "^1.12.31",
    "ngx-avatars": "^1.10.1",
    "ngxtension": "^7.0.2",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zod": "^4.1.13"
  },
  "devDependencies": {
    "@angular/build": "^20.3.12",
    "@angular/cli": "^20.3.12",
    "@angular/compiler-cli": "^20.3.0",
    "@types/file-saver-es": "^2.0.3",
    "@types/jasmine": "~5.1.0",
    "angular-eslint": "21.0.1",
    "concurrently": "^9.2.1",
    "devextreme-cli": "^1.12.2",
    "devextreme-themebuilder": "^25.1.7",
    "eslint": "^9.39.1",
    "firebase-tools": "^14.27.0",
    "husky": "^9.1.7",
    "jasmine-core": "~5.9.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "prettier": "^3.7.4",
    "typescript": "~5.9.2",
    "typescript-eslint": "8.46.4"
  }
}

$ npm list
[email protected] /home/jake/Code/delete-me
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @angular/[email protected]
├── @bufbuild/[email protected] extraneous
├── @fingerprintjs/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── [email protected]
├── [email protected] extraneous
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] extraneous
├── [email protected]
├── [email protected] extraneous
├── [email protected]
├── [email protected]
├── [email protected] extraneous
├── [email protected]
├── [email protected]
├── [email protected] extraneous
├── [email protected] extraneous
├── [email protected] extraneous
├── [email protected] extraneous
├── [email protected] extraneous
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

jakehockey10 avatar Dec 08 '25 18:12 jakehockey10