Sublime Text 2 build with Grunt v0.4.0

I am trying to configure Sublime build to run Grunt (v0.4) This is my assembly fragment:

{ "cmd": ["grunt", "--no-color"], "selector": ["Gruntfile.js"], "path": "/usr/local/bin", "working_dir": "${project_path}", "osx": { "cmd": ["grunt", "--no-color"] } } 

When I hit Command - B , I get the following error:

grunt-cli: grunt command line interface. (V0.1.6) Fatal error: Unable to find local grunt.

If you see this message, either the Gruntfile was not found or did not grumble was not installed locally in your project. For more information on installing and configuring grunt, see the Getting Started manual:

http://gruntjs.com/getting-started [Finished at 0.2 with exit code 99]

When I run grunt from the terminal, everything works.

Any ideas?

+4
source share
3 answers

This is a β€œmistake” of Sublime Text. When you press Ctrl+B , it will invoke the build command with the first open folder as the working directory. Therefore, if you did not open the folder, it cannot find the assembly file (Makefile or, in your case, Gruntfile).

So, in order to build successfully, you need to put your Grunt file in a folder as a working directory, and then open the folder in Sublime Text and press Ctrl+B

+4
source

Before starting GruntJS you need to install it with: npm install grunt --save-dev In the new version of GruntJS, "grunt" is not installed globally, so you can use different versions of GruntJS in each project.

0
source

Type which grunt from the command line, then put the full path into the "cmd" section - for example, "cmd": ["/opt/local/bin/grunt", "--no-color"] . $PATH for ST2 may differ from that in your CLI.

0
source

Source: https://habr.com/ru/post/1468965/


All Articles