How can I restore my Rails 5 binstubs? - bundle

I'm working in a Rails 5 app on macOS Sierra and everything was going well until I was ready for production to a Digital Ocean VPS. I followed one of the most famous Deploy Rails app tutorial using Capistrano, I after some bugs finally my app came to live running on production.
Now in my local environment when I run rails server or rails console I got this warning and I don't know how to fix it or whats going wrong with that.
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 5, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rails app:update:bin # Use the new Rails 5 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
=> Booting Puma
=> Rails application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
I have been searching whats this bug and how to fix it but I have no luck! And for reference it seems to be something with Capistrano but I have done what they said is the solution and it does not work or maybe I have not implement it in the right way:
The solution would be:
1.- remove bin from the linked_dirs (which was not my case)
2.- add set :bundle_binstubs, nil to your config/deploy.rb to generate the binstubs
Some articles I found:
Rails 5 console not working when deploying with Capistrano
I really appreciate any type of help you could provide me.
Thanks in advance.

I know this comes a bit late, but I found that I could run $ rails app:update and it would restore/overwrite my binstubs...along with overwriting all the other configuration files you start out with. So be careful about that.


React create app hot reload is not always working on linux

I created a react application using create-react-app boilerplate, which seems to be very popular, hot reload some times updates when any of the files changes and some times not, seems like there is a minimum duration or something like that, I'm using Ubuntu, node version 7.0, the script in package.json is npm:'react-script start' what I am missing ?
When npm start doesn’t detect changes, below are the common troubleshooting steps provided in the create-react-app documentation - link.
While an app is running with npm start and updating code in the editor should possibly refresh the borswer with the updated code.
If this doesn’t happen, try one of the following workarounds:
If the project files are directly synced to your local system from a cloud storage like Dropbox or Google Drive and your trying to run the app in them directly, try moving it out.
Due to Webpack bug, you may need to restart the watcher. If the watcher doesn’t detect the index.js and you’re referencing it by the folder name.
Safe write feature in editors like Vim and IntelliJ currently breaks the watcher. You will need to disable it.
Due to Webpack watcher bug, projects with path contains parentheses causes issue, try moving the project to a path without them. .
To allow more watchers in Linux and macOS, you might need to tweak system settings.
If the project runs inside a virtual machine such as (a Vagrant provisioned) VirtualBox, create an .env file in your project directory if it doesn’t exist, and add CHOKIDAR_USEPOLLING=true to it. This ensures that the next time you run npm start, the watcher uses the polling mode, as necessary inside a VM.
Could try increasing max_users_watches- link
More references:
Issue Tracker 1
Toubleshooting webpack
Issue Tracker 2 - Webpack polling
Try these:
Turn off safe write in your IDE
Increase max_user_watches
Your path should not have parentheses
as last resort try to use this as your env variable:

Error while running pub deploy: Cannot read link

I'm trying to run pub deploy command in my Dart project, but it always ends with this error: "Pub deploy failed, [1] Cannot read link". No more information outputs into console.
I tried to run it in basic Dart browser project (the one with text reversing), but same error occurred again.
Did anyone have same problem? Any ideas how to fix it?
I have the same issue.
In my case, the Dart project is stored in NTFS hard drive (I share it with Windows OS) and Dart deploy (run from Eclipse) runs on Ubuntu.
Simply move the Dart project to Ubuntu hard drive then things come back to normal.
This is probably a problem with the packages symlinks. If you delete them and run pub install it should work again.
According to dart-sdk/lib/io/link.dart:
On the Windows platform, the link will be created as a Junction
On other platforms, the posix symlink() call is used to make a symbolic link
On Linux platforms, storing Dart project in NTFS drive causes Pub to fail. Because posix symlink() is used on NTFS partition and doesn't create a valid NTFS junction point.
The solution is to move the project folder to a partition that uses posix symlinks natively, such as one formatted to ext4.

Servicemix Bundle Installation directory

I have a bundle up and running in Servicemix for a long time. I cant even use 'history' to see where this bundle got installed from.
Is there any way I could find where this bundle originally got installed from?
As a note: this bundle does exist in my company's central repository but I dont see the exact version there. seems like this bundle got installed using File component something like install file:jar_location/jar_name.
If it's just a standalone bundle, then try
la -l | grep <bundle_id>
This will show the exact installation link. (with protocol as well)
Also it might be just dropped into ${SMX_HOME}/deploy. If you have a simple jar file it can be dropped and got fragmented automatically.
Also I'd check if it's coming from a feature (list the attached feature urls):
It's useful to know if you'll have to updat it. See
features:install / features:uninstall
Hope that helps,

How do I deploy Node.js applications as a single executable file? [duplicate]

This question already has an answer here:
How to make exe files from a node.js app?
17 answers
Supposed I have written a Node.js application, and I now would like to distribute it. Of course, I want to make it easy for the user, hence I do not want him to install Node.js, run npm install and then manually type node app.js.
What I'd prefer was a single executable file, e.g. an .exe file on Windows.
How could I approach this?
I am aware of this thread, anyway this is only about Windows. How could I achieve this in a platform-independent manner? Any ideas? Best practices? ...?
The perfect solution was a "compiler" I can give a source folder to. The source folder contains the app itself in various .js files, the node_modules folder and some metadata, such as the package.json. The output should be binaries for various platforms, such as Windows, OS X and Linux.
Oh, and what's important: I do not want to make any changes to the source code, so calls to require with relative paths should still work, even if this relative path is now inside the packaged app.
Any ideas?
PS: I do not want the user to install Node.js independently, it should be included inside the executable as well.
Meanwhile I have found the (for me) perfect solution: nexe, which creates a single executable from a Node.js application including all of its modules.
Although at the moment it has some disadvantages (does not run on Windows and does not support binary modules), it's the next best thing to an ideal solution.
First, we're talking about packaging a Node.js app for workshops, demos, etc. where it can be handy to have an app "just running" without the need for the end user to care about installation and dependencies.
You can try the following setup:
Get your apps source code
npm install all dependencies (via package.json) to the local node_modules directory. It is important to perform this step on each platform you want to support separately, in case of binary dependencies.
Copy the Node.js binary – node.exe on Windows, (probably) /usr/local/bin/node on OS X/Linux to your project's root folder. On OS X/Linux you can find the location of the Node.js binary with which node.
For Windows:
Create a self extracting archive, 7zip_extra supports a way to execute a command right after extraction, see:
For OS X/Linux:
You can use tools like makeself or unzipsfx (I don't know if this is compiled with CHEAP_SFX_AUTORUN defined by default).
These tools will extract the archive to a temporary directory, execute the given command (e.g. node app.js) and remove all files when finished.
Not to beat a dead horse, but the solution you're describing sounds a lot like Node-Webkit.
From the Git Page:
node-webkit is an app runtime based on Chromium and node.js. You can write native apps in HTML and JavaScript with node-webkit. It also lets you call Node.js modules directly from the DOM and enables a new way of writing native applications with all Web technologies.
These instructions specifically detail the creation of a single file app that a user can execute, and this portion describes the external dependencies.
I'm not sure if it's the exact solution, but it seems pretty close.
Hope it helps!
JXcore will allow you to turn any nodejs application into a single executable, including all dependencies, in either Windows, Linux, or Mac OS X.
Here is a link to the installer:
And here is a link to how to set it up:
It is very easy to use and I have tested it in both Windows 8.1 and Ubuntu 14.04.
FYI: JXcore is a fork of NodeJS so it is 100% NodeJS compatible, with some extra features.
In addition to nexe, browserify can be used to bundle up all your dependencies as a single .js file. This does not bundle the actual node executable, just handles the javascript side. It too does not handle native modules. The command line options for pure node compilation would be browserify --output bundle.js --bare --dg false input.js.
There are a number of steps you have to go through to create an installer and it varies for each Operating System. For Example:
on Mac OS X you need to create a .pkg, there are instructions on how to do that here:
on Ubuntu Linux you need to create a .deb, there are instruction on how to do that here:
on Microsoft Windows you need to create a .exe or .msi, there are instruction on how do that using the innosetup installer here:
I tried using makeself and was successfull. no issues yet. documented steps #
You could create a git repo and setup a link to the node git repo as a dependency. Then any user who clones the repo could also install node.
#git submodule [--quiet] add [-b branch] [-f|--force]
git submodule add /var/Node-repo.git common
You could easily package a script up to automatically clone the git repo you have hosted somewhere and "install" from one that one script file.
#clone git repo
git clone your-repo.git

Yeoman Workflow and Integration with Backend Scripts

So, I've been anticipating Yeoman and it's already out for a week or so now. But after successfully installing it, I've been confused at the workflow and the implementation with backend script (API).
Scenario 1
So let's say I don't need all those shiny BBB/Ember/Angular stuff and use Yeoman just for jQuery/H5BP/Modernizr backed with Codeigniter or Sinatra/Rails. Since yeoman server doesn't natively support PHP (I haven't tried Sinatra/Rails), I figure that the workflow is:
Front End Development with Yeoman
After it's finished, do yeoman build and then use the built dist folder as a base to develop backend (and probably copy the dist folder to another folder for backend implementation (let's say public folder)
If I should change CSS/JS, use yeoman again, build and copy the dist folder to public again. So on and on...
But using that workflow, that means the directory structure will be something like
--yeoman development stuff
--yeoman development stuff
--yeoman built stuff
It's nice and all, but quite a bit different with the CodeIgniter / Rails directory structure. Not to mention there are name difference (is this configurable in Yeoman?), so it's kinda hard to imagine a good workflow developing both Front End and Back End in one go, except using the built result as a base for the backend.
Scenario 2
BBB/Ember/Angular. Frankly I've been just testing those stuff, so any tips to implement with backend code is welcome! Though for all I know, yeoman can generate the necessary files for those framework inside app folder, so I figure, the solution of the first scenario will kinda solve the problem for scenario 2
Thanks a lot!
I like using this structure:
Here's how I set it up:
rails new rails-app
cd rails-app/app/views
mkdir js
cd js
yeoman init ember
Then edit Gruntfile.js to change "output: 'dist'" to "output: '../../../public'"
After that, "yeoman build" or "yeoman build:dist" will output to the Rails /public folder.
During dev, you can still use "yeoman server" to run yeoman in development mode, so any change you make will automatically be visible in the browser.
Yeoman is great!
Sanford's answer will work for Sinatra too of course, but there's a slightly different solution that can be used so that you don't have to issue "yeoman build" to run in development mode.
In Sinatra, the public folder is configurable, so you can have a configure block that looks like this:
configure do
set :public_folder, ENV['RACK_ENV'] == 'production' ? 'dist' : 'app'
Then use your routes like this:
get '/' do
send_file File.join(settings.public_folder, 'index.html')
This is assuming that "yeoman init" was run in the root folder of the Sinatra application.
All you do then is ensure that you've run "yeoman build" before deploying to a production environment, and the yeoman-optimised content will be used.