Skip to content

Loading…

closurebuilder problem with grunt build #22

Closed
zemd opened this Issue · 5 comments

2 participants

@zemd

There is an error ''IOError: [Errno 2] No such file or directory: 'temp/compiled.js'' during building source code.
This happens in this grunt task:

https://github.com/closureplease/generator-closure/blob/master/templates/Gruntfile.js#L210

app: {
  src: [
    CONF.appPath,
    CONF.closureLibrary,
    CONF.componentPath
  ],
  dest: 'temp/compiled.js'
},

if I create 'temp' folder, after running task it get removed.

Had made quick fix for closurebuilder.py for this

if options.output_file:
    output_dir = os.path.dirname(options.output_file)
    if not os.path.exists(output_dir):
        os.makedirs(output_dir)
    out = open(options.output_file, 'w+')
  else:
    out = sys.stdout

but I think this is not an closurebuilder's issue.

@thanpolas
Owner

I could not reproduce the problem... if the issue persists i'd have to have a closer look at either the Grunt Closure Tools or Grunt itself...

What OS are you on? Please provide full environment info if the issue persists.

@zemd

windows 8 x64
Python 2.7.5
node v0.10.24
npm 1.3.22

@thanpolas
Owner

nice, please help me debug, paste me the result of the following command:

grunt build --stack --debug
@zemd
D:\proj>grunt build --stack --debug
Running "clean:dist" (clean) task
[D] Task source: D:\proj\node_modules\grunt-contrib-clean\tasks\clean.js
Cleaning temp...OK

Running "uglify:vendor" (uglify) task
[D] Task source: D:\proj\node_modules\grunt-contrib-uglify\tasks\uglify.js
>> Destination (temp/vendor.js) not written because src files were empty.

Running "closureBuilder:app" (closureBuilder) task
[D] Task source: D:\proj\node_modules\grunt-closure-tools\tasks\closureTools.js
Executing: python app/closure-library/closure/bin/build/closurebuilder.py  -i app/js/main.js --root=app/js/ --root=app/closure-library --root=app/components -o compiled --output_file=temp/compiled.js --compiler_jar=node_modules/superstartup-closure-compiler/build/sscompiler.jar --compiler_flags="--compilation_level=ADVANCED_OPTIMIZATIONS" --compiler_flags="--define='goog.DEBUG=false'" --compiler_flags="--warning_level=verbose" --compiler_flags="--jscomp_off=checkTypes" --compiler_flags="--jscomp_off=fileoverviewTags" --compiler_flags="--summary_detail_level=3" --compiler_flags="--only_closure_dependencies" --compiler_flags="--closure_entry_point=myapp" --compiler_flags="--create_source_map=app/jsc/sourcemap.js.map" --compiler_flags="--source_map_format=V3" --compiler_flags="--output_wrapper=(function(){%output%}).call(this);"
>> Error: Command failed: Traceback (most recent call last):
>>   File "app/closure-library/closure/bin/build/closurebuilder.py", line 268, in <module>
>>     main()
>>   File "app/closure-library/closure/bin/build/closurebuilder.py", line 197, in main
>>     out = open(options.output_file, 'w+')
>> IOError: [Errno 2] No such file or directory: 'temp/compiled.js'
>> FAILED to run command for target: app
Warning: Task "closureBuilder:app" failed. Use --force to continue.
Error: Task "closureBuilder:app" failed.
    at Task.<anonymous> (D:\proj\node_modules\grunt\lib\util\task.js:197:15)
    at null._onTimeout (D:\proj\node_modules\grunt\lib\util\task.js:225:33)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

Aborted due to warnings.
@thanpolas thanpolas closed this in 40e5bec
@thanpolas
Owner

@hunterman fixed, generator will now create the temp/ folder for you, v0.1.13 is on npm.

You experienced an edge case were you removed all vendor files so Grunt did not have a chance to create the temp/ folder before closureBuilder was run...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.