1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

「npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.」の解決方法

1
Posted at

はじめに

GitHub ActionsのCI上でnpm ciを実行したときにエラーが発生しました。

問題

`npm ci` can only install packages when your package.json and 
package-lock.json or npm-shrinkwrap.json are in sync. 
Please update your lock file with `npm install` before continuing.
npm error Invalid: lock file's drizzle-kit@1.0.0-rc.4 does not satisfy drizzle-kit@1.0.0-rc.5-ab785fc
npm error Missing: drizzle-orm@1.0.0-rc.5-ab785fc from lock file
npm error Missing: drizzle-orm@1.0.0-rc.5-ab785fc from lock file

ローカルでnpm ciを実行したときはエラーが発生しませんでした。

解決方法

NodeのバージョンをローカルとCI上で揃える

手順

1. ローカルでNodeのバージョンを確認

node -v
# v24.14.1

2. CIのymlでバージョンを指定

.github/workflows/ci.yml(一部抜粋)
      - name: Setup Node.js
        uses: actions/setup-node@v7
        with:
          node-version: "24.14.1"

元々はバージョンを何も指定していませんでした。

参考文献

おわりに

今までバージョンを意識しなくても何も起きていなかったのであまり重要視していませんでした。
これからはバージョンを意識したいと思います。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?