grunt-init-gruntfile
grunt-init-gruntfile copied to clipboard
Generated package.json is missing attributes used in the banner
Hey,
it's quite obvious that developers using the package.json will add the necessary attributes like name and homepage themselves, but for first time users it might be confusing that this grunt template's grunt tasks fails due to missing package attributes (used in the banner config). The outputted warning with a fresh install is:
Running "concat:dist" (concat) task
Warning: An error occurred while processing a template (Cannot read property 'name' of undefined). Use --force to continue.
Should the generated package.json include placeholders or empty values for all attributes used in the banner, and maybe when using the package.json generator print a notice to edit those.
I can provide a PR for this, if needed.
Or wrap those elements of the banner into conditionals as well in the banner config.
I couldn't get rid of the error even if i added the attributes to the package file.
Yes, I was bit by this and spent several hours on it. So Kontur, thanks for entering the the issue, and no, for first time users, it's not at all obvious that a project that "Create[s] a basic Gruntfile with grunt-init" fails to create a basic gruntfile that works out of the box. The point of "Hello World", it seems to me, is that it works when you DON'T yet know the environment well, without debugging it.
The way I got rid of the error was to comment out the banner altogether.
I had this problem also but this issue has been open and unfixed for 5 years so I am guessing this template is dead.