Sounds easy enough, but I am having some trouble with it...
grunt.registerTask 'import', 'Import map file', ->
mapFile = grunt.option('map')
unless mapFile and (require 'fs').existsSync mapFile
return grunt.log.errorlns """
Please specify map file to be imported using --map flag.
"""
done = this.async()
grunt.util.spawn
cmd: 'coffee'
args: ['src/app/import.coffee', mapFile]
opts:
env: 'DEBUG': 'import:*'
stdio: 'pipe'
done
Basically it's wrapper around that src/app/import.coffee. After executing grunt import --map <filepath> I am getting following error:
Error: 'node' is not recognized as an internal or external command, operable program or batch file.
at callDone (C:\workspace\alpha\node_modules\grunt\node_modules\grunt-legacy-util\index.js:159:56)
at ChildProcess.<anonymous> (C:\workspace\alpha\node_modules\grunt\node_modules\grunt-legacy-util\index.js:198:5)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Socket.<anonymous> (child_process.js:969:11)
at Socket.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
I am confused about this. I can run node from command line without issues. That stack trace is not really helpful as the actual error happens somewhere asynchronously. I can execute coffee src/app/import.coffee without issues.