0
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 3 years have passed since last update.

npm install時に起きたエラーとその対処法の忘却録

0
Posted at

はじめに

dockerコンテナに入って

# npm install && npm run dev

こちらのコマンドを実行したがエラーが発生した。

まずこちらのコマンドの目的や実行内容についてよくわからなかったので
調べて解明を行うことにした

まず&&というのはnpm installが実行されたらnpm run devも実行するというつなぎの役割を果たしています。

つまり処理としては

# npm install
# npm run dev

と同じです。

npm installについて

まずnpm とはNode Package Managerの略で、Node.jsのモジュールを管理するツールだそう。
そしてNode.jsで作成されているらしいです。

このコマンドはpackage.jsonの内容に従ってインストールを行います。
そうすることでpackage.jsonに格納されている情報をインストールすることができます。

とても便利ですね。

つまり、このコマンドを実行する際にエラーが起こったということは
package.jsonの内容のどこかに問題があると疑うことが大事だとわかりました。

今回もpackage.jsonのバージョンの違いに問題があったらしくエラーが発生しました。

そのバージョンを修正したら問題解決できました。

結論

これからは実行するコマンドの目的、仕組みを理解してから
そのエラーの原因を解明することが大切だと学べました。

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