You should commit the components
folder when creating apps. This is the recommended practice for with npm too. That way you can ensure that you only deploy exactly what you have locally. Bower will get a shrinkwrap
command eventually, but for now this is the way to go.
Nodejitsu and bower install
-
30-05-2022 - |
Question
Did anybody try to deploy application that uses https://github.com/bower/bower to Nodejitsu hosting?
The problem is npm pack
command which is used by nodejitsu to deploy app. It ignores all files that are starting with dot, and especially .bowerrc
that's why I cannot run bower install
as post deploy script..
Any suggestions? Maybe to use empty .npmignore
file?
Thanks!
Solution 2
OTHER TIPS
I had the same issue and (somehow) I solved it without committing the bower_components
folder. Since Bower reached 1.0, it is possible to consume the API programatically rather than going through the command line interface. Hence, you can create a small script as below:
var bower = require('bower'),
path = require('path');
bower.commands
.install([path.resolve(".")])
.on('end', function (installed) {
console.log(installed);
});
On Nodejitsu it is possible to trigger commands pre and post deployment using the script
field in your package.json
. Thus, I can trigger my bower install on postdeployment with:
{
"name": "myapp",
"version": "0.0.1",
"description": "",
"main": "app.js",
"scripts" : {
"predeploy": "echo This will be run before deploying the app",
"postdeploy": "node bower_install.js",
"start": "node app.js"
},
"dependencies": {
...
}
}
Where bower_install.js
is the script above.