Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何修复Node.js中的Heroku web部署错误(例如:H10)? 问题摘要 我在访问我的网站时遇到H10错误,该网站是从Heroku部署的 它在本地服务器上运行,没有任何问题 错误发生在我更新了NPM,然后部署到Heroku之后 详细的NPM错误显示“找不到模块”和“启动脚本失败”_Javascript_Node.js_Heroku_Web Deployment_Webdeploy - Fatal编程技术网

Javascript 如何修复Node.js中的Heroku web部署错误(例如:H10)? 问题摘要 我在访问我的网站时遇到H10错误,该网站是从Heroku部署的 它在本地服务器上运行,没有任何问题 错误发生在我更新了NPM,然后部署到Heroku之后 详细的NPM错误显示“找不到模块”和“启动脚本失败”

Javascript 如何修复Node.js中的Heroku web部署错误(例如:H10)? 问题摘要 我在访问我的网站时遇到H10错误,该网站是从Heroku部署的 它在本地服务器上运行,没有任何问题 错误发生在我更新了NPM,然后部署到Heroku之后 详细的NPM错误显示“找不到模块”和“启动脚本失败”,javascript,node.js,heroku,web-deployment,webdeploy,Javascript,Node.js,Heroku,Web Deployment,Webdeploy,我应该如何解决这个问题 以前的方法 我已经搜索了这个问题的解决方案,并检查了我的端口设置、procfile、package.json和.gitignore,但仍然得到了错误 代码示例 app.js中的我的端口设置 > let port = process.env.PORT; if (port == null || port == "") { port > = 3000; } > > app.listen(port,function() { c

我应该如何解决这个问题

以前的方法 我已经搜索了这个问题的解决方案,并检查了我的端口设置、procfile、package.json和.gitignore,但仍然得到了错误

代码示例 app.js中的我的端口设置

> let port = process.env.PORT; if (port == null || port == "") {   port
> = 3000; }
> 
> app.listen(port,function() {   console.log("Server started on port
> 3000"); });
package.json

> {   "name": "todolist-v1",   "version": "1.0.0",   "description": "", 
> "main": "app.js",   "scripts": {
>     "test": "echo \"Error: no test specified\" && exit 1",
>     "start": "node app.js"
> 
>   },   "author": "",   "license": "ISC",   "engines": {
>     "node": "10.14.2"
> 
>   },   "dependencies": {
>     "async": "^2.6.2",
>     "body-parser": "^1.18.3",
>     "date-and-time": "^0.6.3",
>     "ejs": "^2.6.1",
>     "express": "^4.16.4",
>     "jsqr": "^1.2.0",
>     "lodash": "^4.17.11",
>     "moment": "^2.24.0",
>     "mongoose": "^5.5.2"   } }
.gitignore

/node_modules
npm-debug.log
.DS_Store
/*.env
web: node app.js
Procfile

/node_modules
npm-debug.log
.DS_Store
/*.env
web: node app.js
heroku错误

2019-04-24T05:37:09.064416+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=young-thicket-75018.herokuapp.com request_id=8d2ebd1c-0e87-4048-aa63-667672ad11a2 fwd="129.128.60.85" dyno= connect= service= status=503 bytes= protocol=https
Error: Cannot find module '../wireprotocol/constants'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/app/node_modules/mongodb-core/lib/sdam/topology_description.js:5:24)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! todolist-v1@1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the todolist-v1@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
NPM错误

2019-04-24T05:37:09.064416+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=young-thicket-75018.herokuapp.com request_id=8d2ebd1c-0e87-4048-aa63-667672ad11a2 fwd="129.128.60.85" dyno= connect= service= status=503 bytes= protocol=https
Error: Cannot find module '../wireprotocol/constants'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/app/node_modules/mongodb-core/lib/sdam/topology_description.js:5:24)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! todolist-v1@1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the todolist-v1@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
错误:找不到模块“../wireprotocol/constants”
位于Function.Module.\u resolveFilename(internal/modules/cjs/loader.js:581:15)
at Function.Module._load(内部/modules/cjs/loader.js:507:25)
at Module.require(内部/modules/cjs/loader.js:637:17)
根据需要(内部/modules/cjs/helpers.js:22:18)
反对。(/app/node_modules/mongodb core/lib/sdam/topology_description.js:5:24)
at模块编译(内部/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js(internal/modules/cjs/loader.js:700:10)
在Module.load(内部/modules/cjs/loader.js:599:32)
在tryModuleLoad(内部/modules/cjs/loader.js:538:12)
at Function.Module._load(内部/modules/cjs/loader.js:530:3)
npm错误!代码失效循环
npm错误!错误1
npm错误!托多利斯特-v1@1.0.0start:`node app.js`
npm错误!退出状态1
npm错误!
npm错误!在托多利斯特失败了-v1@1.0.0开始脚本。
npm错误!这可能不是npm的问题。上面可能还有其他日志输出。