在Windows上运行grunt时,我收到“拒绝访问"消息.默认grunt.js文件出错 [英] When running grunt on Windows, I receive "Access is Denied" error with default grunt.js file
问题描述
我正在Windows 7计算机上安装grunt.js.我在%PATH%
上安装了Grunt设置,但是当我尝试执行它时,却收到此错误:
I'm getting grunt.js setup on a Windows 7 machine. I've got Grunt setup on my %PATH%
, but when I try to execute it, I receive this error:
C:\project>grunt
Access is denied.
但是,如果我将grunt文件从grunt.js
重命名为gruntfile.js
并使用--config
标志重新运行Grunt,它将起作用:
However, if I rename the grunt file from grunt.js
to gruntfile.js
and rerun Grunt using the --config
flag, it works:
C:\project>grunt --config gruntfile.js
...Lots of Grunt output...
5 specs, 0 failures in 0.041s.
Done, without errors.
我的%PATH%
设置如下:
set PATH=.;%NODE_HOME%;%PATH%
知道为什么我会看到此访问被拒绝"错误吗?
Any idea why I'm seeing this "Access is denied" error?
推荐答案
Grunt's FAQ gives me the solution:
如果与grunt.js gruntfile位于同一目录中,则Windows 当您键入grunt时,尝试执行该文件.所以你需要输入 而是grunt.cmd.
If you're in the same directory as the grunt.js gruntfile, Windows tries to execute that file when you type grunt. So you need to type grunt.cmd instead.
该FAQ所显示的输出与我所看到的有所不同;使用grunt.cmd
可以解决此问题.
The FAQ just showed a different output than what I was seeing; using grunt.cmd
fixes it.
这篇关于在Windows上运行grunt时,我收到“拒绝访问"消息.默认grunt.js文件出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!