When running grunt on Windows, I receive “Access is Denied” error with default grunt.js file

邮差的信 提交于 2019-12-11 12:10:37

问题


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.

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.

My %PATH% is setup with follows:

set PATH=.;%NODE_HOME%;%PATH%

Any idea why I'm seeing this "Access is denied" error?


回答1:


Grunt's FAQ gives me the solution:

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.

The FAQ just showed a different output than what I was seeing; using grunt.cmd fixes it.



来源:https://stackoverflow.com/questions/12269658/when-running-grunt-on-windows-i-receive-access-is-denied-error-with-default-g

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!