Help us understand the problem. What is going on with this article?

コマンドプロンプトでgruntが実行できない時の対処法

More than 5 years have passed since last update.

コマンドプロンプト上で、grunt.jsがあるフォルダでgruntと入力しても実行されません。

C:\path\to\project>dir
...
-a---        2012/10/05      0:18       3004 grunt.js
...

C:\path\to\project>grunt

C:\path\to\project>

環境変数PATHEXTに、拡張子を省略したコマンドが入力された場合に補完(探索)する拡張子が指定されています。

>set PATHEXT
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.RB;.RBW

コマンドプロンプトはbashと違い、頭に./を付けなくてもカレントフォルダのファイル・フォルダを叩きに行けるので
PATH(→npm)内のgrunt実行ファイルを見に行く前にカレントフォルダのgrunt.jsを見つけてしまいます。

対処法は拡張子を省略せずに打ち込む

>grunt.cmd

か、またはPATHEXTから.JS;を取り除きます。
grunt 0.4.0からはgrunt.jsがGruntfile.jsに変わるようなので心配なくなるのですが。

2k0ri
シェル芸でやっつけてしまうJavaエンジニア
http://2k0ri.org/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした