user2047330
user2047330

Reputation: 119

Deploying a Node.js app based on Deployd (deployd.com) on Appfog

I'm trying to deploy a node.js app, based on Deployd (deployd.com). When deploying by "af update myapp", I get the following error:

Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (2K): OK   
Push Status: OK
Stopping Application 'myapp': OK
Staging Application 'myapp': OK                                              
Starting Application 'myapp': .
Error: Application [myapp] failed to start, logs information below.

====> /logs/staging.log <====

# Logfile created on 2013-07-23 15:18:29 +0000 by logger.rb/25413
Skipping npm support: npm-shrinkwrap.json is not provided

====> /logs/stderr.log <====


module.js:340
    throw err;
      ^
Error: Cannot find module 'deployd'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/mnt/var/vcap.local/dea/apps/myapp-0-     cd2bdee578441089a86b3b0331a96cd5/app/index.js:1:77)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)

So it seems that there is a problem with the Deployd module. I declared it in the package.json file:

{
  "name": "myapp-test-deployd",
  "version": "0.0.1",
  "dependencies": {
    "deployd": "0.6.10"
  },
  "engines": {
  "node": "0.10.x",
  "npm": "1.2.x"
  }
}

I tried to install it by: npm install -d

Or: npm install deployd

But I get the same error. I don't understand why this module doesn't work on Appfog. It works locally·

Thanks.


The log (final part, which for me seems interesting) that I get when running sudo npm install deployd --save

In a subdirectory: npm http ... [and so on] npm http 304 https://registry.npmjs.org/stack-trace npm http 304 https://registry.npmjs.org/delayed-stream/0.0.5 npm http 304 https://registry.npmjs.org/ini npm http GET https://registry.npmjs.org/tinycolor npm http GET https://registry.npmjs.org/options npm http 304 https://registry.npmjs.org/tinycolor npm http 304 https://registry.npmjs.org/options

> [email protected] install /home/me/Development/myapp-deployd-test   /node_modules/deployd/node_modules/socket.io/node_modules/socket.io-    client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory `/home/me/Development/myapp-deployd-test/node_modules/deployd/node_modules/socket.io/node_modules/socket.io- client/node_modules/ws/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node: Finished
  COPY Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  SOLINK_MODULE(target) Release/obj.target/validation.node: Finished
  COPY Release/validation.node
make: Leaving directory `/home/me/Development/myapp-deployd-test/node_modules/deployd/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
[email protected] ../node_modules/deployd
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] 
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

Upvotes: 2

Views: 1847

Answers (3)

konsumer
konsumer

Reputation: 3503

npm shrinkwrap tells appfog about native dependencies. Also, try removing engine section. Those are not supported versions. I also like to add a scripts tag for start, but the default entry-point app.js should work without it.

For more info, see here: https://docs.appfog.com/languages/node

Upvotes: 1

Tim Santeford
Tim Santeford

Reputation: 28131

Try using the --save option of npm to insure the package.json file is correct and that the dependency is stored into the node_modules subfolder.

npm install deployd --save

After running that command in the app's root folder, your app folder should look like:

<app folder>/node_modules/deployd/ <tons of sub dependencies>
<app folder>/package.json
<app folder>/<and other app files>

Upvotes: 2

Nafiul Islam
Nafiul Islam

Reputation: 82550

One of the main problems is when using npm, is that you install a package globally and hence always have access to it. However, in this case you need to upload the packages as well to appfog.

This is how you do it.

  1. Use cmd or terminal to go to your project root.
  2. Install all the modules that you are going to need, for example deployd or underscore for example via npm install <module> -d. This will install all your modules inside a new your current directory in a folder called node_modules. Upload everything including node_modules folder to appfog.
  3. If you have subdirectories, then you can do one of two things, you can change require statements to match the directory from the root, so if you have something like root > dir, then you will have to give these kinds or require statements, such as var deployd = require("./../deployd"). Or you can go into each sub directory and install the modules it needs.

Upvotes: 1

Related Questions