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

An error occurred while processing a template (Cannot read property 'js' of undefined). #14

Closed
dmitryevseev opened this issue Nov 12, 2013 · 11 comments

Comments

@dmitryevseev
Copy link

Using module v0.4.5.

Here is the task config:

ngconstant: {
      options: {
        space: '  '
      },
      development: {
        constants: { API_CONFIG: { baseUrl: 'http://localhost:8080/api' } },
        dest: 'source/js/env-config.js',
        name: 'environment-config',
        wrap: 'define(["angular"], function (angular) {\n"use strict";\n<%= __ngModule %>});'
      }

And this is grunt output:

Verifying property ngconstant.development exists in config...OK
Files: -> source/js/env-config.js
Reading /../node_modules/grunt-ng-constant/tasks/constant.tpl.ejs...OK
Warning: An error occurred while processing a template (Cannot read property 'js' of undefined). Use --force to continue.

Appreciate your help.

@mlegenhausen
Copy link
Owner

I am unable to reproduce it. I ran your configuration without any error.

Which node version are you using?

@dmitryevseev
Copy link
Author

It's v0.10.21

@dmitryevseev
Copy link
Author

Comment removed. See configs below.

@mlegenhausen
Copy link
Owner

Can you reproduce it when you are not using your generateEnvConfig function and only execute grunt ngconstant:development?

It would be nice if you could create a minimal example project where I can reproduce it.

@dmitryevseev
Copy link
Author

If I leave everything apart of ng-constant from Gruntfile.js it works. Seems like some module interfering with it. Digging for more details

@dmitryevseev
Copy link
Author

Alright, here goes minimal setup: https://gist.github.com/dmitryevseev/7428655
It boils down for me to ng-constant + jshint.

@dmitryevseev
Copy link
Author

It's resolved after updating jshint config (see new revision of gist). Still not sure why jshint task was breaking ng-constant.

@mlegenhausen
Copy link
Owner

Thats strage cause I am using jshint too for testing. What was exactly your change in the jshint config?

@dmitryevseev
Copy link
Author

Yep, that's it

@mlegenhausen
Copy link
Owner

It seemed that app_files variable was not defined, which caused the error. I don't know why this happened in the ngconstant task instead of jshint but this was a configuration error.

Closed for now.

@dmitryevseev
Copy link
Author

@mlegenhausen Thanks for your time spent to help with this!

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

No branches or pull requests

2 participants