【发布时间】:2016-11-30 04:51:40
【问题描述】:
我使用 node.js 做了一个小项目,用 Discord 做一些事情。当我使用 node server.js 和 npm start 在本地运行它时,它起作用了。我决定将我的项目放到网上,看看某个功能是否有效。当我上传它时,没有找到启动所有内容的主要 javascript 文件 (server.js)。
错误至极:
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"
}
}
文件结构:
Discord
└─── .git
└─── node_modules
└─── rbservers <-nothing is used in this folder
└─── app.js
└─── package.json
└─── server.js
如果有人能指出我忘记了什么愚蠢的事情,请告诉我。
我在 OpenShift 上的墨盒是“Node.js 自动更新”墨盒。
【问题讨论】:
-
您是否使用 npm install 命令安装了所有必需的依赖项?
-
您检查过文件夹的权限吗?并安装了所有包
-
@AJS 是的。我在我的 node_modules 文件夹中找到了这两个依赖项。
-
@ManishSingh 可以肯定的是,我只是重新运行该命令并发布到 OpenShift。没有任何改变。
-
你能显示module.js代码吗?究竟在哪一行你得到了错误。还有你如何包含 server.js
标签: javascript node.js openshift