Exiftool in nodejs for heroku - node.js

I have the problem that I need to use the exiftool, since I could command more metadata packages that are in NPM. But this program is not loaded in heroku, What is the method to install this command?

To get extra binaries, dependencies, libs, etc onto the dyno, you should specify additional buildpacks as documented here:
https://github.com/benalavi/buildpack-exiftool
The gist is:
heroku buildpack:set https://github.com/heroku/heroku-buildpack-multi
Then in .buildpacks:
https://github.com/benalavi/buildpack-exiftool
https://github.com/heroku/heroku-buildpack-nodejs
That will first download & install exiftool, then install node and use node (the final item listed) as your app buildpack.

Related

How to zip a nodejs server app?

I have to create a zip file of my whole nodejs server app.
I should be able to unzip it and run it, without installing dependencies and apps.
It should not be a binary file.
The dependencies should be flattened.
How to do this thing ?
Generally, a Node.js app has its dependencies installed in the node_modules directory in the project root.
So, after running npm install (or npm install --production), you should be able to zip up the project directory and that should be all you need.
If any of your dependencies in node_modules are native addons, then you will not be able to install them on a different architecture or OS. If there are native addons, you will also want to make sure your target machine has the same version of node installed as the machine where you created the zip file. (It's a good idea anyway, if you can, to make sure the node version on the target machine is the same as the source machine.)
One obvious requirement of the target host if you do as I describe above is that node is already installed there. Not sure if that's OK for your use case or not, but sounds like it probably is?
Thank you, all of you for your help.
I got the solution for my question.
I am using npm pack to pack the nodejs app.
To pack nodejs app with some dependencies like morgan, express we need to use npm bundle it helps to include the other module required for node js app.
With this, we don't need to perform npm install.
We just have to install bundle and then include bundleDependencies field including the name of required module in package.json.
And then perform then run the command npm pack. It will create a tar file just copy this file in other folder and uncompress it and run the server starting file.
The place where you are going to run the nodejs file, there nodejs app should be installed
I think you might be looking for this: https://github.com/nexe/nexe
Nexe is a command-line utility that compiles your Node.js application into a single executable file.

Meteor: Cannot find module 'angular'

I'm newbie on Meteor.
After one week on it, and started by implementing the todo of the tutorial as describe here, every things was good locally.
just the fact that I'm continually trying to deploy it, but my heroku
link(https://tasktor.herokuapp.com) just show a blank page with
the this error in de debugger:
Error: angular#^1.2.27 not installed. tmeasday_check-npm-versions.js:66:11
Error: Cannot find module 'angular'
Note that everything is clean on http://localhost:3000.
Already try a lot of solutions, as:
meteor add angular
meteor npm install --save angular
Disable minification of Js and Css.
This is the repository of this app deployed to heroku: https://github.com/dassiorleando/tasktor
his buildpack: https://github.com/dassiorleando/heroku-buildpack-meteor,
it is a buildpack with an updated Node Engine(4.5.0), that allowed to run an app with the meteor 1.4.X version.
Knowing that I add Angular-Material after finish this tutorial, because I wanted to have a clean material design style on my todo. You can check the repository to look about.
How can I handle this situation ?
Thanks in advance.
Doing this:
meteor add angular
Adds an old atmosphere angular-meteor package, which also refers to an old (1.2.27) version of angular. The best way to proceed is to remove this and just use angular npm packages. You will need these packages
pbastowski:angular-babel
urigo:static-templates
dotansimha:accounts-ui-angular
The last one is if you are using the accounts package.
The tutorial at https://www.angular-meteor.com/tutorials/socially/angular1/bootstrapping recommends this:
So let's remove it by running:
$ meteor remove blaze-html-templates
$ meteor remove ecmascript
Now let's add the Angular 1 package to Meteor, back in the command
line, launch this command:
$ meteor npm install --save angular angular-meteor babel-runtime
$ meteor add angular-templates pbastowski:angular-babel
That's it! Now we can use Angular 1's power in our Meteor app.

Meteor 0.9.0 bundle and deploy throw errors

I upgraded to Meteor 0.9.0 today. I use meteor bundle filename to bundle my application and upload to AWS. When I try to start it on AWS, I get
wrong ELF class: ELFCLASS32
This is a known problem with fibers/bcrypt, so I used to go to bundle/programs/server/node_modules, remove the fibers and bcrypt folders and reinstalling them (npm install).
However, currently the node_modules directory does not exist anymore... When I am trying to start nodejs I get
Error: Cannot find module 'underscore'
I tried to manually add the modules with npm install, and even got the server to eventually run, but the client didn't load and the console error was about
Spacebars undefined
(I don't have the exact Spacebar issue)
I know that Meteor 0.9.0 is very new, but if you have advice I would really appreciate it!
You don't need to remove any folders, simply do this in the bundle directory (output of the untarred meteor bundle):
cd bundle
cd programs/server
npm install
Meteor 0.9.0 makes sure it puts up all the node_modules which don't contain binaries, and creates a package.json for npm install for both bcrypt and fibers
Since you've removed the npm modules in node_modules you may have to recreate the bundle from scratch to get them back.
For the Spacebars undefined issue its very likely that you have a package in your project that is not compatible with Meteor 0.9.0. You can find out which one it is by checking your server logs. Though it is not compatible, your app will still run.
This may be boostrap-3, though it may not be. If it is you can meteor remove mrt:bootstrap-3 and meteor add mizzao:bootstrap-3.
Akshat, you are a lifesaver! Based on your answer I eventually managed to figure it out! For the benefit of others, I want to document what eventually worked:
First, I had to manually remove all the old packages from my Meteor project (seems that it didn't do it automatically). In particular, I removed
iron-router
which was the pre-Meteor 0.9 version and installed
iron:router
which is the post-Meteor 0.9 version. (I had to do a similar process of removing and adding different packages for 2-3 other packages too).
Then, once I bundled and unpacked on AWS, I did what Akshat said about npm install in bundle/programs/server. In addition, I had to manually remove the original bctypt by deleting the folder
bundle/programs/server/npm/npm-bcrypt
as otherwise I got an ELS error
If you're getting this error with Meteor-Up. Updating the package should fix it.
npm update mup -g

How to setup Gruntfile to use compass/sass on heroku?

I've successfully set up my heroku app with the grunt buildpack. When I push my Node.js app to heroku it will run the appropriate grunt task.
What I'd like is to use the 'grunt-contrib-compass' package to compile my .scss files. But that requires the compass executable and I don't know how to get that.
I've checked the heroku documentation and have seen an outdated doc that describes setting up compass with ruby... but I haven't seen any recent documentation for setting it up with Node.js.
Any ideas?
This took a lot of figuring out, but I've finally managed to get it to work. What's needed is to get Ruby to install alongside your Node.js app, so you can install the appropriate gems. This gist was very helpful and more-or-less describes what I needed to do.
In summary, the process was:
Create the files .buildpacks, Gemfile, and Gemfile.lock in the project directory, with the following contents:
.buildpacks
https://github.com/heroku/heroku-buildpack-ruby.git
https://github.com/heroku/heroku-buildpack-nodejs.git
Gemfile
source "http://rubygems.org"
gem "sass"
Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
sass (3.4.5)
PLATFORMS
ruby
DEPENDENCIES
sass
nb. I'm only using Sass, not Compass, but I'm guessing all you'll need to do to get compass is just add gem "compass" to the Gemfile and, eg. compass (1.0.3) below sass in the Gemfile.lock.
Add a multi buildpack to your app:
heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
Finally, push these out to Heroku, and Ruby and Sass should install alongside your Node.js app, allowing you to use sass-related grunt tasks.
There is a forked-fork that includes compass installation. That might help:
https://github.com/stephanmelzer/heroku-buildpack-nodejs-grunt-compass
I got my app working on heroku using grunt-sass instead of grunt-contrib-sass. To swap them out just do npm install --save grunt-sass and then swap out the grunt-task wherever it's used (e.g.
grunt.loadNpmTasks('grunt-sass') instead of grunt.loadNpmTasks('grunt-contrib-sass')

Avoid npm refresh after every deployment on Heroku

I have a Node.js website hosted on Heroku, that I deploy with git.
I use several node modules, referenced in package.json; is there a way to prevent Heroku to 'refresh' them each time I deploy a new version of the code, as long as package.json did not change?
Note: this would be especially useful for 'native' modules, whose compilation takes a bit of time; for .js-only modules, I was successful removing them from package.json, and adding their node_modules/ folder in the git repo.
I'm the maintainer of the official Heroku Node.js Buildpack.
We have a new version of the buildpack in beta that features caching support, designed specifically for the use case you described above. You can read more about it at https://github.com/heroku/heroku-buildpack-nodejs/tree/diet#about-this-refactor
Eventually this will become the default Node.js buildpack on Heroku, but if you want to use it now you'll need to set the BUILPACK_URL config var explicitly:
heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#diet -a my-node-app
git commit -am "fakeout" --allow-empty
git push heroku
Seems like there has recently been progress by David Dollar at the heroku-buildpack-nodejs.
In short:
heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-nodejs
See answer here:
https://stackoverflow.com/a/18535675/1318839
You can add both .js and native npm packages and still avoid the "refresh", (at least the re-downloading part of the "refresh".)
Include the native packages to your node_modules/ directory. When you deploy to Heroku, npm install will skip the downloading of the package. npm rebuild is also run. It will take some time to re-compile the native packages, but it should be very bearable unless you have tons of native packages.
Sidenote: Heroku doc on what Heroku does when you push a nodejs app.
Sidenote: The npm rebuild is needed because there "are mysterious failures that can happen between node and native code modules after a node upgrade".
Clone the Heroku node.js buildpack, and modify it to remove the rebuild command.
The command is currently run here:
https://github.com/heroku/heroku-buildpack-nodejs/blob/master/bin/compile#L180 , but that's bound to change.
You can run create an app that uses your own buildpack by modifying the command below to match your own repo:
heroku create --buildpack http://github.com/heroku/heroku-buildpack-nodejs.git
Or change the buildpack of an existing app with:
heroku config:add BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-nodejs.git

Resources