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 run div で「npm error code ENOENT」や 「npm error syscall open」とかが出た時の対処法

Last updated at Posted at 2025-09-23

はじめに

UbuntuでReact環境を実行しようとした時にタイトルのエラーが発生したので対処法のメモ

問題

Ubuntuで「npm run div」とコマンドを打ったら「npm error 何とかかんとか」って表示が数行表示されて、React環境が実行できない。

$ npm run dev

npm error code ENOENT
npm error syscall open
npm error path /home/hoge/package.json
npm error errno -2
npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/home/hoge/package.json'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
npm error A complete log of this run can be found in: /home/hoge/.npm/_logs/2025-09-23T01_29_56_533Z-debug-0.log

解決方法

package.jsonファイルが存在しないフォルダ上で実行した為、このようなエラーが発生した。カレントディレクトリを「package.json」ファイルが存在する作業フォルダにcdコマンドで移動して、再度「npm run div」で無事実行できた。

おわりに

初歩的だけどCUI操作少しずつ慣れていこう。

追記
誤字ってたんで修正しました、、、「nmp → npm」

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?