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?
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.
Nice after quite some searching on google joshs solution fixed my problem. I just removed <%= yeoman.app %>
wiredep: {
options: { */code was here */ }
}
The solution is to delete the cwd property from the Grunfile.js
See this for reference:
https://github.com/stephenplusplus/grunt-wiredep/issues/100
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.
You has to set the grunt-wiredep dependency to the fix version.
"grunt-wiredep": "1.8.0",
Related
I am working with grunt and when I write "grunt build" my dist folder builds everything, except for the js files. I get the following message:
I'm guessing I have to edit my Gruntfile, but I'm not sure how to go about solving this.
My Gruntfile is long, but here is the uglify part:
What does it mean by the destination was not written because src files were empty
It means the files listed in dist: {src:"<%config.app%>*" were not created yet. Use the following process:
Run copy and uglify manually and verbosely
grunt copy:dist --verbose
grunt uglify:dist --verbose
If it works, reorganize the task in question in the registerTask method:
grunt registerTask("build", ['copy:dist','uglify:dist']);
Otherwise, dump the <%config.app%> path to make sure it is correct
grunt.registerTask('dump', 'Dump Output', function(){ console.log(grunt.config.get() ) });
References
Grunt API: grunt.config.get
Grunt Documentation: Using the CLI
I've tried to configure uncss using grunt
I've installed
npm install grunt-uncss --save-dev
npm install grunt-processhtml --save-dev
Configuration
uncss: {
dist: {
files: { 'dist/css/clean.css': ['index.php'] }
}
}
at the end I load them in and register a default task like this :
grunt.loadNpmTasks('grunt-uncss');
grunt.loadNpmTasks('grunt-processhtml');
grunt.registerTask('default', ['uncss', 'processhtml']);
Result
When I run grunt
at the end I keep seeing :
Running "uncss:dist" (uncss) task
Fatal error: PhantomJS: Cannot open about:blank
Update
I added :
processhtml: {
dist: {
files: {
'index.php': ['index.php']
}
}
}
Still get the same error after running grunt
If this is all of your code, you are not referencing any stylesheets to remove code from. All you are doing is telling grunt where the cleaner file should go, and to remove any unused css from index.php. However, it doesn't know where the styles for index.php live, so it has nothing to do... You need to actually configure your processhtml and tell uncss which stylesheets you would like to clean up.
Read the directions friend:
grunt-uncss github readme.md
I have that problem with my project and the solution is here:
You need update the uncss module, remember grunt-uncss is only a way to use uncss node package. In my case my version of that was in 0.12.1 and updating that package the problem was fixed. Let me know if this help you.
I'm using grunt-contrib-clean to try to delete the _node_modules_ folder on the build machine at the end of a build.
But I recently added a new node module dependency, grunt-sass, which is causing the 'clean' task to fail, unable to delete the file node-sass\bin\win32-x64-v8-3.14\binding.node.
I think the node sass file is still in use, because if I comment out the grunt.loadNpmTasks('grunt-sass'); shown below, then the clean works.
Q1: Can I "unload" an npm task, sort of like reversing the `loadNpmTasks('grunt-sass')'?
Q2: Is cleaning up by deleting 'node_modules' at the end of the CI build the right thing™ to be doing?
Details:
Windows 7 x64
npm list
├─┬ grunt-contrib-clean#0.6.0
│ └── rimraf#2.2.8
gruntfile.js
grunt.loadNpmTasks('grunt-sass');
⋮
clean: {
post: [
'node_modules/grunt-sass' // was 'node_modules', but this is for debugging
]
}
results in error:
Running "clean:post" (clean) task
ERROR
Warning: Unable to delete "node_modules" file (EPERM, operation not permitted 'c:\myfold
er\node_modules\grunt-sass\node_modules\node-sass\bin\win32-x64-v8-3.14\binding.node').
Use --force to continue.
Note:
There's a grunt-clean-contrib github issue discussing this same exact issue (same file). It has some comments saying that upgrading rimraf from v2.2.7 to v2.2.8 fixed it for them. But I'm using 2.2.8 and still seeing the failure.
While trying to execute grunt command.
I have used yeoman, bower, generator-angular and grunt with nodejs in windows 7.
Everything worked fine. And I have added font-awesome with bower-install, and to update my html I executed grunt wiredep.
it throws the following error.
Also my bower components are outside app folder, But in index file it started with bower_compontents/jquery/dist/jquery.js instead ../bower_components/jquery/dist/jquery.js.
The problem is with the node modules.
I just deleted it and executed npm install again. All worked well :-)
Change bower_components path
in .bowerrc file, I have changed the directory path. :-)
I have a grunt plugin, let's call it grunt-my-plugin and within the plugin's Gruntfile I have a specific cssmin task that needs to be run. Everything works as expected when testing the grunt plugin, however, when I install it on another project it gives me the following error:
Warning: Task "cssmin" not found. Use --force to continue.
At first, I was just calling grunt.task.run('cssmin'); from the plugin's task file, but then after seeing the error I realized that the Gruntfile that uses this plugin needs to be pointed to the appropriate task config, so I added:
grunt.task.loadTasks('./Gruntfile.js');
That still have me the error, so I tried:
grunt.task.loadTasks('./node_modules/grunt-my-plugin/Gruntfile.js');
Still getting the error. So, how do I fix this? The plugin does not need specific config from a Gruntfile that uses it. The cssmin task is being used to create a tmp copy and run metrics against it. Any ideas on how to achieve this? Thanks!
Ensure the following:
your plugin has the grunt-contrib-cssmin plugin listed as a dependency in package.json
you have npm install-ed in the other project (check with npm ls grunt-contrib-cssmin)
supply configuration for the cssmin task using grunt.config() before calling grunt.task.run('cssmin') (see this GitHub comment for an idea)