Forums/Cloud Foundry Forums/CloudFoundry.com Q&A

Answered

Can't deploy node app with npm packages (Can't deploy application containing links...)

Rafael Magana
asked this on November 22, 2011 17:28

I'm using node v0.4.11 and vmc 0.3.13, the node application works locally, it has a packages.js where I specify the dependencies (express, redis, connect-redis, etc), I've seen some blogs where people recommend doing: npm bundle, but my current version doesn't have this command, npm install creates the node_modules, but it creates a .bin folder and vmc is throwing this error:

 

Error: Can't deploy application containing links '["/Users/yada/MyApp/node_modules/.bin/express"]' that reach outside its root '/Users/yada/MyApp/'


Any clue?

 

Comments

User photo
David Ascher
Ajax_loader_small Answer

I've found that you can just delete the symlink (you're not going to want the express script installed anyway), and the push will work.

There's a bug in the link-analysis code which I filed on github: https://github.com/cloudfoundry/vmc/issues/36

November 23, 2011 11:27
User photo
Glenn Oppegard
Cloud Foundry

Thanks for the analysis David. I've filed a bug report and linked this thread as well as your GitHub issue so that Cloud Foundry engineering is aware of the problem.

If you need to fix the issue in vmc and are using Ruby 1.9.2 or greater, you can fix the bug:

$ gem which vmc 
/Users/goppegard/.rvm/gems/ruby-1.9.2-p290/gems/vmc-0.3.14.beta.4/lib/vmc.rb


Edit /Users/goppegard/.rvm/gems/ruby-1.9.2-p290/gems/vmc-0.3.14.beta.4/lib/cli/commands/apps.rb
Search for "def check_unreachable_links" and change the line from:

  File.symlink? f and !File.expand_path(File.readlink(f)).include? path

To:

  File.symlink? f and !File.realdirpath(f).include? path

November 23, 2011 11:58
User photo
Rafael Magana

@david and @Glenn both workarounds worked like a charm, thanks a lot! I hope the CF engineers fix this asap.

November 24, 2011 08:47