0

I made a little project using node.js to do a few things with Discord. It worked when I ran it locally with node server.js and npm start. I decided to put my project online to see if a certain feature worked. When I uploaded it, the main javascript file (server.js) that starts everything wasn't found.

I just want to be clear that Module.js is not something I made, but part of the node.js built in modules. It's the thing that makes the require function what it is.

The error in all it's glory:

module.js:472
    throw err;
    ^
Error: Cannot find module '/var/lib/openshift/583e028e2d52714d2500041/approot/runtime/repo/server.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3

Package.json:

{
  "name": "app",
  "version": "0.0.1",
  "description": "test",
  "scripts": { 
    "start": "node --use_strict server.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "main": "server.js",
  "keywords": [
    "discord",
  ],
  "author": "kert",
  "license": "ISC",
  "dependencies": {
    "express": "^4.14.0",
    "discord.js": "7.0.0"
  },
  "engines" : {
    "node" : "6.9.1"
  }
} 

Structure of files:

Discord
└─── .git
└─── node_modules
└─── rbservers <-nothing is used in this folder
└─── app.js
└─── package.json
└─── server.js

If anyone can point out what stupid thing I'm forgetting, pray tell.

My cartridge on OpenShift is the 'Node.js Auto-Updating' one.

13
  • 1
    Have you installed all the required dependencies using npm install command? Commented Nov 30, 2016 at 4:55
  • 1
    have you checked permissions for folders ? and installed all packages Commented Nov 30, 2016 at 4:55
  • @AJS Yes. I found both dependencies in my node_modules folder. Commented Nov 30, 2016 at 4:58
  • @ManishSingh To be sure, I just reran that command and published to OpenShift. Nothing changed. Commented Nov 30, 2016 at 5:03
  • can you show module.js code . On which line exactly you are getting error. And also how you are including the server.js Commented Nov 30, 2016 at 5:04

1 Answer 1

1

Apparently, git wasn't staging/committing all the files in order for them to be pushed. I'll have to look around on how to fix this.

Ugh.

Sign up to request clarification or add additional context in comments.

1 Comment

fixed by git add *

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.