admin管理员组文章数量:1404593
I'm trying to get grunt.js
set up on my work machine. Now I've managed to get it set up at home, so I pushed my repository, then cloned it on my work machine, however despite troubleshooting this to death I've always run into the same issue when I e to try and run the mand on my work puter;
sh.exe": grunt: mand not found
So some background and explanation;
- I'm using
Aptana 3.0
and running all my mands through the terminal. (This applies to my home and work puter) - I cloned the "working" repository and put it in a folder on my work machine, so I have my
package.json
andgruntfile.js
files inside said directory. These work fine on my home puter and I am able to run the watch task set up in mygruntfile.js
successfully at home. - I've run
npm install grunt-cli -g
andnpm install
inside my project on my WORK puter and installation has been successful each time. My only error messages on either are a lack of description and a repository field which, to my knowledge these aren't mandatory? The node modules folder inside my repository indicates I have the following installed (as per my package.json)
grunt
grunt-contrib-pass
grunt-contrib-uglify
grunt-contrib-watch
matchdep
Now I'm pretty green to this mand line stuff, so I may have overlooked something very obvious but I feel like I've tried every guide going to get this thing to work.
Despite running through the getting started steps/installing grunt documentation repeatedly, it seems no matter what I do the terminal will not pick up grunt as a recognized mand.
Am I stupid or is this some other issue?
EDIT 1: contents of my package.json:
{
"name" : "xxxxxxxxx",
"version" : "xxxx",
"dependencies" : {
"grunt":"~0.4.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-pass": "~0.5.0",
"grunt-contrib-uglify": "~0.2.2",
"matchdep": "~0.1.2"
}
}
I'm trying to get grunt.js
set up on my work machine. Now I've managed to get it set up at home, so I pushed my repository, then cloned it on my work machine, however despite troubleshooting this to death I've always run into the same issue when I e to try and run the mand on my work puter;
sh.exe": grunt: mand not found
So some background and explanation;
- I'm using
Aptana 3.0
and running all my mands through the terminal. (This applies to my home and work puter) - I cloned the "working" repository and put it in a folder on my work machine, so I have my
package.json
andgruntfile.js
files inside said directory. These work fine on my home puter and I am able to run the watch task set up in mygruntfile.js
successfully at home. - I've run
npm install grunt-cli -g
andnpm install
inside my project on my WORK puter and installation has been successful each time. My only error messages on either are a lack of description and a repository field which, to my knowledge these aren't mandatory? The node modules folder inside my repository indicates I have the following installed (as per my package.json)
grunt
grunt-contrib-pass
grunt-contrib-uglify
grunt-contrib-watch
matchdep
Now I'm pretty green to this mand line stuff, so I may have overlooked something very obvious but I feel like I've tried every guide going to get this thing to work.
Despite running through the getting started steps/installing grunt documentation repeatedly, it seems no matter what I do the terminal will not pick up grunt as a recognized mand.
Am I stupid or is this some other issue?
EDIT 1: contents of my package.json:
{
"name" : "xxxxxxxxx",
"version" : "xxxx",
"dependencies" : {
"grunt":"~0.4.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-pass": "~0.5.0",
"grunt-contrib-uglify": "~0.2.2",
"matchdep": "~0.1.2"
}
}
- 1 Have you read through this? stackoverflow./a/19137584/463205 – athms Commented Dec 17, 2014 at 10:04
- @athms Fantastic, I had no idea about setting PATH variables before reading that, hadn't e across that one, thanks a lot for your help, it now recognizes grunt as a mand - sorted! – defteH Commented Dec 17, 2014 at 10:35
- @athms add your post as an answer - I think it should be accepted – Alexey Shcherbak Commented Dec 17, 2014 at 11:35
- Thanks @AlexeyShcherbak, I've just added it. – athms Commented Dec 18, 2014 at 9:48
2 Answers
Reset to default 3This is happening because you are using the Aptana Terminal, which needs the PATH variable to work out what is meant by grunt etc. A normal cmd prompt would work fine with the mand npm install grunt-cli -g
but in this context the terminal is unaware of what grunt
is.
As per the following existing answer, you need to set up your Windows PATH variable to make the Aptana Terminal aware of the npm directory: https://stackoverflow./a/19137584/463205
C:\Users\Username\AppData\Roaming\npm
Closing the terminal and reopening it after setting the PATH correctly should enable you to run the mand successfully.
Try to run
npm install grunt-cli -g
On your home puter.
-g
means - install Grunt globally (not in the project node_modules folder), so it'll add grunt mand to the bin folder which is used by nodejs console ( and you need to run node.js mand prompt, not just arbitrary cmd)
本文标签: javascriptGruntjs Installation IssueCommand Not FoundStack Overflow
版权声明:本文标题:javascript - Grunt.js Installation Issue - Command Not Found - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744840483a2627895.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论