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

More than 1 year has passed since last update.

React、npm run devコマンド実行時のエラー解決

Posted at

Reactプロジェクトで

npm run dev

コマンドを実行した際に、
下記エラー


プロジェクト名

sh: vite: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! react-output-router-ts@0.0.0 dev: `vite`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the react-output-router-ts@0.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

が表示されたので解決策コマンドを記述します。

結論npmとmodulesの依存関係のエラーなので、

//時々バグがあるのでnpmを更新
npm install -g npm@latest
//既存のモジュールを削除
rm -rf node_modules
//プロジェクトの依存関係を再インストール
npm install

コマンドを実行で解決します!!

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