What is causing 'grunt serve' to throw 

2020-02-17 12:34发布

I am starting out angular app with angular-fullstack in my Windows 7 box. I installed bunch of npm packages with -g options, including grunt-bower-install. I created the application first by running

yo angular-fullstack appname

There were no exception during the application creation. After application was created successfully I tried to run the app using

grunt serve

expecting the server to run. But the 'grunt serve' failed with

Running "bower-install:app" (bower-install) task Cannot find where you keep your Bower packages.

We tried looking for a .bowerrc file, but couldn't find a custom directory property defined. We then tried bower_components, but it looks like that doesn't exist either. As a last resort, we tried the pre-1.0 components directory, but that also couldn't be found.

Unfortunately, we can't proceed without knowing where the Bower packages you have installed are.

Fatal error: No Bower components found.

I did find .bowerrc file and it was pointing to app/bower_components. Unfortunately, bower_components file was no where to be found. I am not sure what should be the content of the file to create it myself. Is it the missing file causing this problem or is there a npm package, I did not install correctly?

  • I installed bower using npm as well *

Thanks

9条回答
三岁会撩人
2楼-- · 2020-02-17 12:56

I had the same issue, here's what worked in my case:

  1. installed ruby and compass (yeoman needs these)
  2. verified that path to Ruby bin folder is added to %PATH%
  3. installed Git
  4. restarted cmd window and ran "bower install" in the app folder

After that, grunt serve command worked perfectly. Note: maybe installing Git and running bower install would suffice in your case.

查看更多
你好瞎i
3楼-- · 2020-02-17 12:57

Confusingly, the grunt-bower-install task that comes with angular-fullstack doesn't install bower components. It doesn't install anything. This error is trying to let you know that it can't find the bower_components directly, so it can't do its thing.

To fix the issue, run bower install.

If you don't have Bower installed, run npm install -g bower first.

查看更多
Lonely孤独者°
4楼-- · 2020-02-17 12:58
npm install -g bower
bower install
grunt serve

worked for me ...

查看更多
登录 后发表回答