Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Unable to read "undefined" file (Error code: ENOENT) when compiling coffeescript from watch #6

Merged
merged 1 commit into from
Sep 13, 2013

Conversation

tschaub
Copy link
Owner

@tschaub tschaub commented Sep 13, 2013

First, thank you for putting this plugin together. I spent a good portion of my day trying various approaches to having grunt coffee compile only changed files and then livereloading those changes.

With that being said, I am running into the following error (with verbose output):

Running tasks: newer:coffee:dist

Running "newer:coffee:dist" (newer) task
Files: app/application.coffee -> .tmp/application.js
Files: app/boot.coffee -> .tmp/boot.js
Files: app/bower_components/backbone/test/model.coffee -> .tmp/bower_components/backbone/test/model.js
Files: app/config.coffee -> .tmp/config.js
Files: app/controllers/base/authenticated.coffee -> .tmp/controllers/base/authenticated.js
Files: app/controllers/base/controller.coffee -> .tmp/controllers/base/controller.js
Files: app/controllers/home_controller.coffee -> .tmp/controllers/home_controller.js
Files: app/controllers/session_controller.coffee -> .tmp/controllers/session_controller.js
Files: app/lib/GCS.coffee -> .tmp/lib/GCS.js
Files: app/models/base/grid_model.coffee -> .tmp/models/base/grid_model.js
Files: app/models/connect.coffee -> .tmp/models/connect.js
Files: app/models/user.coffee -> .tmp/models/user.js
Files: app/routes.coffee -> .tmp/routes.js
Files: app/vendor.coffee -> .tmp/vendor.js
Files: app/views/base/view.coffee -> .tmp/views/base/view.js
Files: app/views/home/main.coffee -> .tmp/views/home/main.js
Files: app/views/session/signin.coffee -> .tmp/views/session/signin.js

Running "coffee:dist" (coffee) task
Verifying property coffee.dist exists in config...OK
Files: [no src] -> .tmp/application.js
Files: [no src] -> .tmp/boot.js
Files: [no src] -> .tmp/bower_components/backbone/test/model.js
Files: [no src] -> .tmp/config.js
Files: [no src] -> .tmp/controllers/base/authenticated.js
Files: [no src] -> .tmp/controllers/base/controller.js
Files: [no src] -> .tmp/controllers/home_controller.js
Files: [no src] -> .tmp/controllers/session_controller.js
Files: [no src] -> .tmp/lib/GCS.js
Files: [no src] -> .tmp/models/base/grid_model.js
Files: [no src] -> .tmp/models/connect.js
Files: app/models/user.coffee -> .tmp/models/user.js
Files: [no src] -> .tmp/routes.js
Files: [no src] -> .tmp/vendor.js
Files: [no src] -> .tmp/views/base/view.js
Files: [no src] -> .tmp/views/home/main.js
Files: [no src] -> .tmp/views/session/signin.js
Options: bare, join=false, sourceMap, separator="\n", sourceRoot=""
Reading undefined...ERROR
Warning: Unable to read "undefined" file (Error code: ENOENT). Use --force to continue.

And the relevant portion of my Gruntfile.coffee:

# monitor for changes
  watch:
    coffee:
        files: 'app/**/*.coffee'
        tasks: ['newer:coffee:dist']

Works if I use any-newer but then it is compiling every file. Am I simply misinterpreting the docs?

@roparz
Copy link

roparz commented Sep 13, 2013

+1 ;-)

@tschaub
Copy link
Owner

tschaub commented Sep 13, 2013

@tritonrc - can you post the files config for your coffee:dist target?

Here's a complete configuration that works for me:

  grunt.initConfig({
    watch: {
      coffee: {
        files: 'app/**/*.coffee',
        tasks: ['newer:coffee:dist']
      }
    },
    coffee: {
      dist: {
        expand: true,
        src: 'app/**/*.coffee',
        dest: 'dist',
        ext: '.js'
      }
    }
  });

@tritonrc
Copy link
Author

Sure thing:

# in lieu of javascript
    coffee:
      options:
        bare: true
        sourceMap: true
        sourceRoot: ''
      dist:
        files: [
          expand: true,
          cwd: 'app'
          src: '**/*.coffee'
          dest: '.tmp'
          ext: '.js'
        ]

The only difference being my use of cwd which is interesting. I am going to try without the cwd

@tschaub
Copy link
Owner

tschaub commented Sep 13, 2013

Ok, it's the sourceMap option. I can reproduce it here (works with false, fails with true). I'll dig into this a bit later. Thanks for the report.

@tschaub
Copy link
Owner

tschaub commented Sep 13, 2013

@tritonrc - the change in 2f34b01 fixes it for me. If you're able to apply the same change to your installed grunt-newer, I'd be interested to hear how it works for you.

If it is easier to test with a release or I don't hear back shortly, I'll cut a new release with this fix.

@tritonrc
Copy link
Author

@tschaub -- Worked liked a charm, thank you so much for you quick response and effort.

tschaub added a commit that referenced this pull request Sep 13, 2013
Properly filter out file config objects with no source files.
@tschaub tschaub merged commit 2082147 into master Sep 13, 2013
@tschaub tschaub deleted the filter-files branch September 13, 2013 17:37
@tschaub
Copy link
Owner

tschaub commented Sep 13, 2013

Good news. Published as [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants