grunt serve from a fresh Yeoman install returns - Warning: Task "serve" not found
Asked Answered
D

3

7

After running yo angular and then cd'ing into the application's root folder (at same level as the app folder, gruntfile, package.json etc) I try grunt serve and I get the above error. Grunt won't start a server for me.

I have searched all over but couldn't find say to run npm install and bower install within the application's root directory, which I have tried but still the same error.

I've updated and checked bower/grunt/npm and they're all good.

Any suggestions please?

Dragster answered 21/7, 2014 at 5:56 Comment(0)
D
6

I think I have found a solution!

http://yang-wei.github.io/blog/2014/06/01/npm-install-issues-plus-angularjs-set-up/

Running sudo on all the installs causes issues on the NPM folder in the home directory. I needed to change permissions of all usr/local folders by running:

sudo chown -R $USER /usr/local

sudo chown -R `whoami` ~/.npm

npm install -g yo grunt-cli bower

Now I go through the process again and no more errors!

The above link also seems to be pulled together from a bunch of answers at npm throws error without sudo

Dragster answered 22/7, 2014 at 0:15 Comment(0)
C
0

The Gruntfile.js is not present under app directory but the root directory, i.e. parent of the app directory.

You must run the grunt serve form the root directory, i.e. parent of the app directory.

Carillonneur answered 21/7, 2014 at 6:4 Comment(7)
sorry - I am doing that - when I say app folder I meant the parent application folder (which contains an app folder and Gruntfile etc). Sorry for the confusion, I'll update the OP.Dragster
I tried yo angular before replying. It worked out smoothly. Please retry the whole process and paste the error log it it happens again.Carillonneur
OK. I'll run through the full process on the yeoman site again. I have node v0.10.29, NPM 1.4.14, Git 1.8.5.2 installed. Sudo installed --global yo. Now I check versions: yo - 1.2.0, bower - 1.3.8, grunt-cli v0.1.13, grunt v0.4.5. Sudo npm install --global [email protected].Dragster
(apparently I took too long editing the above. sorry, continues:) mkdir testyo cd testyo yo angular OK so at this point I get a lot of errors as it goes through the yeoman install process... There are a lot if 'Please try running this command again as root/Administrator.' errors but I can't run sudo yo. I'll have to include the npm-debug.log separately.Dragster
Lets try it once again. sudo npm i yo; sudo npm i generator-angular; Then navigate to desired directory. yo angular; Let's see what happens.Carillonneur
Can't post the error log as it's too big! Is this a permissions thing?Dragster
It looks like it was to do with permissions caused by using sudo on everything... I have posted an answer with the links that got me there. thanks!Dragster
F
0

I encountered similar error with "task --- not found" message.
I tried bitfidget's solution, but it couldn't help. It seemed to be different problem.
I updated yo and grunt-cli module like this:

npm update -g yo
npm update -g grunt-cli

and re-created whole project by "yo" command.
This solved the problem. I hope this can be help for anyone.

Faille answered 14/12, 2014 at 14:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.