「致命的なエラー: ローカル grunt が見つかりません。」と表示される。「grunt」コマンドを実行すると、質問する

「致命的なエラー: ローカル grunt が見つかりません。」と表示される。「grunt」コマンドを実行すると、質問する

次のコマンドでgruntをアンインストールしました。

npm uninstall -g grunt

次に、次のコマンドで grunt を再度インストールしました。

npm install -g grunt-cli

次のリンクにアクセスしてください:https://npmjs.org/package/grunt-html

上記のgruntプラグインを使いたい

しかし、grunt コマンドを実行すると、次のエラーが発生します。

D:\nodeJS\node_modules\grunt-html>grunt
grunt-cli: The grunt command line interface. (v0.1.6)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started

ベストアンサー1

すべては、gruntjs.com

grunt-cli をインストールしても、grunt タスク ランナーはインストールされないことに注意してください。grunt CLI の役割は単純です。Gruntfile の横にインストールされている grunt のバージョンを実行するだけです。これにより、同じマシンに複数のバージョンの grunt を同時にインストールできます。

したがって、プロジェクトフォルダに(できれば)最新のGruntバージョン:

npm install grunt --save-dev

オプションは次のように--save-dev追加されますgrunt開発依存あなたのパッケージ.jsonこれにより、依存関係の再インストールが容易になります。

おすすめ記事