Error deploying node js app onto Cloudbees ClickStart

180 views Asked by At

I'm trying to deploy a node app onto the Cloudbees ClickStart.

I've create a node js ClickStart (this creates the jenkins job, git repository and application container).

Zipped up my app, then deployed using the Cloudbees SDK.

bees app:deploy -t nodejs -a nodeshort -v nodeshort.zip 

When I try to access the URL the application is deployed on I get a 502 Bad Gateway.

Checking the application logs, I see the following printed multiple times:

module.js:340
    throw err;
          ^
Error: Cannot find module '/mnt/e1/genapp-apps/660f9784/main.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

What has caused this? More importantly, what can I do to resolve it? I've tried trashing the clickstart and recreating, but I get the same outcome each time.

Thanks

1

There are 1 answers

0
Captain Haddock On BEST ANSWER

The way in which you zip the file is important.

zip -r ../myapp.zip * => WORKS FINE

zip -r myapp.zip myapp/* => DOES NOT WORK

nodejs stack expect a "main.js" script to be present in application rootdir.

You have this nodejs ClickStart working. Maybe you should compare your code with the ClickStart.