Yeoman error launching project with "grunt" command - gruntjs

I was following yeoman tutorial http://yeoman.io/codelab/prepare-production.html and everything worked fine until I tried to launch my project with "grunt" command then I got the following error:
Running "autoprefixer:dist" (autoprefixer) taskAutoprefixer's process() method is deprecated and will removed in next major release. Use postcss([autoprefixer]).process() insteadFile .tmp/styles/main.css created.
jit-grunt: Plugin for the "ngtemplates" task not found.If you have installed the plugin already, please setting the static mapping.See https://github.com/shootaroo/jit-grunt#static-mappings
Warning: Task "ngtemplates" failed. Use --force to continue.
Aborted due to warnings.
I use Linux Mint 17

A workaround was posted at the generator-angular github. Try modifying your Gruntfile.js to make the jit-grunt block look like this:
// Automatically load required Grunt tasks
require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
ngtemplates: 'grunt-angular-templates',
cdnify: 'grunt-google-cdn'
});

This is a issue for grunt-autoprefixer which is deprecated.
I am guessing, you installed a old version of generator-angular and current version of grunt which is written in the tutorial with following commands.
npm install --global yo bower grunt-cli
npm install --global generator-angular#0.11.1
It is better to install the current version of generator-angular. Just run this and start over again.
npm install -g generator-angular

Related

Grunt release : Warning: Task "release" not found and it shows "aborted due to warnings"

Grunt release : Warning: Task "release" not found and shows aborted due to warnings.
But it shows hint like "Use --force to continue". If i use "--force" to the command it is working fine. What's happening when i use --force before and after.
Double check that all the dependencies for your project are properly installed by running npm install. If there's errors, update your question with that information.
If that does not resolve the problem, check package.json for the grunt-release plugin. It will be found under dependencies or devDependencies. If it's missing from package.json, run npm install grunt-release --save-dev to install the plugin and save it to your project dependencies.
If any errors occur while attempting to resolve your problem this way, update your question and include that information.

Grunt command - unable to find local grunt

I copied an existing Grunt project from git repo and when i run - grunt serve-dev command it tells me the following:
Fatal error: Unable to find local grunt.
If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started
But if i - grunt -version it says:grunt-cli v0.1.13.
What might be the issue?
Be sure to run npm install after cloning the repo. Usually the node_modules, such as grunt aren't included the repo itself by default, but you must install them yourself.

Grunt+Foundation: css/foundation.css created, content [object Object]

I just got started with Bolt.cm (CMS) which comes along with Foundation for frontend.
I've installed Node, NPM, Node-sass, Bower and Grund and started a "grunt watch" in the theme directory.
Grunt is running ("waiting") and when I edit a file in the scss folder (the one from the theme of course, not from the bower_components, I know I should not edit them) the task is successfully executed:
Running "sass:dist" (sass) task.
File "css/foundation.css" created.
Done, without errors.
Theme & versions:
I copied this theme to modify it locally: https://github.com/bolt/base-2014
Grunt version is grunt-cli v0.1.13
NPM version 1.3.10
bower version 1.4.1
The problem
When i open css/foundation.css, the file does not contain CSS code, but only [object Object] as text.
This is the output when i run grunt --verbose:
grunt --verbose
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Registering "grunt-sass" local Npm module tasks.
Reading /var/www/bolt/theme/avoe/node_modules/grunt-sass/package.json...OK
Parsing /var/www/bolt/theme/avoe/node_modules/grunt-sass/package.json...OK
Loading "sass.js" tasks...OK
+ sass
Registering "grunt-contrib-watch" local Npm module tasks.
Reading /var/www/bolt/theme/avoe/node_modules/grunt-contrib-watch/package.json...OK
Parsing /var/www/bolt/theme/avoe/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch
Loading "Gruntfile.js" tasks...OK
+ build, default
No tasks specified, running default tasks.
Running tasks: default
Running "default" task
Running "build" task
Running "sass" task
Running "sass:dist" (sass) task
Verifying property sass.dist exists in config...OK
Files: scss/foundation.scss -> css/foundation.css
Options: includePaths=["bower_components/foundation/scss"], outputStyle="compressed", sourceComments="none"
Writing css/foundation.css...OK
File "css/foundation.css" created.
I managed to fix this issue by going into node_modules folder, removing and reinstalling grunt-sass and node-sass:
rm -rf node-sass
rm -rf grunt-sass
npm install node-sass
npm install grunt-sass
The reinstallation of grunt sass updated my foundation-libsass-template repo, which is where i think the issue may have lay.
It may be that you don't even need to touch node-sass, so perhaps give grunt-sass a go first.
Hope this helps.

Multiple Grunt tasks not found

I am trying to build a yeoman generator and using the tutorial as a guide
http://yeoman.io/generators.html#writing-your-first-generator
I copied the Gruntfile.js from the gist referenced and put it in my generator's template directory. When I generate the project, I run
npm install && bower install
then
grunt test
Local Npm module "grunt-template-jasmine-requirejs" not found. Is it installed?
Warning: Task "concurrent:test" not found. Use --force to continue.
Aborted due to warnings.
Execution Time (2014-01-10 16:19:20 UTC)
loading tasks 3ms
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 50%
test 2ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 33%
Total 6ms
It is not clear to me why Grunt concurrent:test is not found. Grunt finds the clean:test task. I tried commenting the concurrent task and none of the other tasks were found for "test" except "clean". Here is the task list
grunt.registerTask('test', [
'clean:server',
'concurrent:test',
'autoprefixer',
'connect:test',
'karma'
]);
Good point jakerella I see now I was using different grunt file in my yeoman generator then I intended. When I replace Gruntfile.js with the one from the gist referenced in the yeoman tutorial, I get the same issue with a different task. Its says "watch" is not found.
$ ls node_modules/
bower grunt-contrib-compass grunt-contrib-jshint grunt-template-jasmine-requirejs
connect-livereload grunt-contrib-concat grunt-contrib-jst grunt-usemin
grunt grunt-contrib-connect grunt-contrib-livereload load-grunt-tasks
grunt-bower-requirejs grunt-contrib-copy grunt-contrib-requirejs matchdep
grunt-connect-proxy grunt-contrib-cssmin grunt-contrib-uglify moment
grunt-contrib-clean grunt-contrib-htmlmin grunt-open time-grunt
grunt-contrib-coffee grunt-contrib-imagemin grunt-regarde
$ grunt server
>> Local Npm module "grunt-template-jasmine-requirejs" not found. Is it installed?
Warning: Task "watch" not found. Use --force to continue.
Aborted due to warnings.
$
I had the same problem. I solved it by running:
npm install grunt-x --save-dev replacing x with the name of the missing task repeatedly until done.
Incidentally I has first tried npm install -g grunt-x and that didn't work.
After some work at identifying dependencies, I was able to get this to work once I copied the entire foundation app directory and then used the foundation5 generator's index.js list of files to copy from the template directory as a guide to additional resources that were required by my generator. I think this may be a helpful way for anyone trying to repurpose existing generators and help identify Grunt dependencies.

npm: "Error: invalid version: 1.0" while installing grunt plugins

While yesterday all works fine, today i am getting the printed error below, when i try to install a grunt plugin, wether it is a official grunt contrib or vendor plugin.
I am running grunt v0.4, node v0.8.20 and npm v1.2.11, System X 10.8.2.
npm install grunt-<plugin>-<name> --save-dev
npm ERR! Error: invalid version: 1.0
npm ERR! at validVersion (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:590:40)
npm ERR! at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:342:23)
...
What suprises me is that also official grunt contrib plugins (grunt-contrib-xxx) fails to install altough i expect it has a proper semver version syntax. npm-debug.log shows nothing additional to the verbose output in the console.
Any hints are appreciated.
Thx in advance
felic
Sorry for replying this late.
I am new to the grunt/nodejs stuff, so I was a bit confused and it took a while to understand what's wrong: I updated grunt to 0.4.~ at that point without editing the related project package.json to reflect the correct grunt versioning ("1.0.0" instead of "0.1.0"). Thanks for your help.
Modify package.json to
"devDependencies" : {
"grunt" : "latest"
}
Now run
sudo npm install
This installs latest grunt.
[Note : Add required dependencies to object and the command will install it all on run]
since grunt 0.4 is aimed at the v1 of node maybe the plugin you're trying to install asks for a 1.0 version of node, try to read the package.js of the plugins yo're trying to install.
as glortho asked, you could tell us explicitely what plugin causes the problem

Resources