LoginSignup
1
0

More than 3 years have passed since last update.

【npmのエラー罠】脱出のための秘伝のタレ的コード

Posted at

はじめに

こちらに書かれている内容で確かにnpmのエラーの解決率は高いのですが、今後、自分がエラーに陥った際もなぜエラーになってしまったのかが重要ですので、極力エラーの原因を探った上で使用することが最適だと思います。

随時更新

解決策①:node_modulesを消して再インストール

rm -r node_modules
npm install

その後に、もう一度コマンドを実行

rm -r node_modules:node_modulesの削除→依存関係にあるファイルを削除する

解決策②:package-lock.jsonを消して再インストール

rm package-lock.json
npm install

その後に、もう一度コマンドを実行

rm package.lock.json:もう一度、モジュールを入れ直すためpackage-lock.jsonを削除

解決策③:キャッシュをクリアしてみる

npm cache clean -f
npm install

その後に、もう一度コマンドを実行

npm cache clean --f:キャッシュフォルダーからすべてのデータを削除。
--fはちなみに、-forceの略です。

解決策④

参考

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