2
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?

stackblitzでCannot find native binding. npm has a bug related to optional dependencies... エラーが出る

2
Posted at

はじめに

stackblitzにて、Vanila(JavaScript)でプロジェクトを作成したらRunning start commandでエラーが出たのでまとめます

問題

プロジェクト作成したらターミナルで、npm install && npm run dev が実行されます。その際に下記のエラーが発生しました。

Error: Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at eval (file:///home/projects/vitejs-vite-vlfdrkbx/node_modules/rolldown/dist/shared/binding-BMtuZhvP.mjs:617:34)
    at Module.eval (file:///home/projects/vitejs-vite-vlfdrkbx/node_modules/rolldown/dist/shared/binding-BMtuZhvP.mjs:25:49)
    at eval (file:///home/projects/vitejs-vite-vlfdrkbx/node_modules/rolldown/dist/shared/parse-B7LUicIJ.mjs:19:84)

解決方法

  1. package.json の vite を ^7.1.0 に変更
  2. rm -rf package-lock.json を実行
  3. npm install を実行
  4. npm run dev を実行

おわりに

Vite8の内部ビルドツールがstackblitzで起動できないエラーが起きていたようです。まさかここでつまづくと思ってなかったけど解決できてよかったです。

2
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
2
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?