Grunt wiredep:app no such file or directory bower.json

浪子不回头ぞ 提交于 2019-11-27 10:29:12

问题


I'm trying to deploy my Yeoman's Angular app to my production server. When I try to run the grunt build command I get this error:

Running "wiredep:app" (wiredep) task Warning: ENOENT, no such file or directory '/usr/share/nginx/html/data/gaia-app/app/bower.json' Use --force to continue.

If I use grunt --force my app is broken...

I'm on Ubuntu 14.04

Any ideas?


回答1:


There are two solutions to this issue depending on which version of wiredep you want to use.

If you want to use '^1.9.0', make sure to remove the cwd property from your Gruntfile.js. This is a common issue if you are an angular-generator user which currently specifies a cwd property on the config for the wiredep task.

If you don't mind using '1.8.0', make sure to pin that version in your package.json. If you are including wiredep via grunt-wiredep, then you will have to add wiredep manually and pin it. In the case that you stick with '1.8.0', leave the cwd property in the config for the task.




回答2:


Nice after quite some searching on google joshs solution fixed my problem. I just removed <%= yeoman.app %>

wiredep: {      
  options:  { */code was here */ }
}



回答3:


The solution is to delete the cwd property from the Grunfile.js

See this for reference:

https://github.com/stephenplusplus/grunt-wiredep/issues/100




回答4:


This answer I found from Melmoth:

Grunt wiredep:app Cannot find Bower packages

Plus commenting out line 166 in gruntfile.js :

// cwd: '<%= yeoman.app %>'

fixed the issue for me.


Adding detail as per request

I am doing the Yeoman 1 hour codelab http://yeoman.io/codelab.html

After installation I ran grunt serve and got an error: Running "wiredep:app" (wiredep) task Warning: ENOENT, no such file or directory '../charlottesFolder/app/bower.json'

I tried moving:

charlottesFolder/bower.json to charlotteFolder/app/bower.json (don't actually do this as it was wrong)

which then threw the error: Running "wiredep:app" (wiredep) task Cannot find where you keep your Bower packages.

This led me to Melmoth's answer for Cannot find Bower packages - his solution worked in conjunction with commenting out the cwd line (currently line 166) in Gruntfile.js.




回答5:


You has to set the grunt-wiredep dependency to the fix version.

"grunt-wiredep": "1.8.0",



来源:https://stackoverflow.com/questions/25709324/grunt-wiredepapp-no-such-file-or-directory-bower-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!