jasmine - Configuring jshint using grunt and gradle -
i trying configure jshint using grunt , combining gradle, while trying run task below error facing
loading "jshint.js" tasks...error >> error: cannot find module 'jshint' >> @ function.module._resolvefilename (module.js:338:15) >> @ function.module._load (module.js:280:25) >> @ module.require (module.js:364:17) >> @ require (module.js:380:17) no tasks specified, running default tasks. running tasks: default i facing error --> loading "jshint.js" tasks...error
below steps followed
package.json
{ "name": "sample", "version": "0.0.0", "description": "sample project", "main": "scripts/main.js", "scripts": { "test": "scripts/spec" }, "repository": "", "author": "", "license": "bsd", "devdependencies": { "grunt": "~0.4.1", "grunt-contrib-jshint": "~0.6.0" } } gruntfile.js
module.exports = function(grunt) { grunt.initconfig({ jshint: { files: ['gruntfile.js', 'vm/**/*.js'], options: { globals: { jquery: true, console: true, module: true } } } }); grunt.loadnpmtasks('grunt-contrib-jshint'); grunt.registertask('test', 'jshint'); }; grunt.gradle
import org.apache.tools.ant.taskdefs.condition.os import org.gradle.api.tasks.exec def windows_source_dir = "c:\node_modules" task jshint(type: grunttask) { dependson = ['gruntlink'] gruntargs = "jshint" workingdir 'src/main/webapp/' } task gruntlink(type: exec) { description = "installs node.js dependencies defined in package.json" if (os.isfamily(os.family_windows)) { commandline 'cmd', 'mklink /d windows_source_dir src/main/webapp/node_modules' } else { commandline = ["ln", "-nfs", "/usr/local/lib/node_modules/grunt_modules", "src/main/webapp/node_modules"] } } class grunttask extends exec { private string gruntexecutable = os.isfamily(os.family_windows) ? "grunt.cmd" : "grunt" string gruntargs = "" public grunttask() { super() this.setexecutable(gruntexecutable) } public void setgruntargs(string gruntargs) { this.args = "$gruntargs".trim().split(" ") list } }
have run npm install in root of project directory? need local installation of jshint run grunt task. :-)
Comments
Post a Comment