【问题标题】:App not deploying with "start node.js" script应用程序未使用“start node.js”脚本部署
【发布时间】:2020-04-02 05:18:43
【问题描述】:

我正在尝试使用 Google Cloud 部署 Discord 机器人。每当我尝试使用 gcloud app deploy 进行部署时,都会收到此错误:

> discord-bot@1.0.0 start /app
> node index.js

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'discord.js-commando'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/app/index.js:1:28)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! discord-bot@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the discord-bot@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-12-09T05_48_58_649Z-debug.log

这就是我的 package.json 的样子:

  "name": "discord-bot",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
    "dev": "nodemon index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^11.4.2",
    "dotenv": "^7.0.0"
  },
  "devDependencies": {
    "nodemon": "^1.18.11"
  }
}

任何帮助将不胜感激。谢谢!

【问题讨论】:

  • 错误很明显“错误:找不到模块'discord.js-commando'”。在 package.json 中添加“discord.js-commando”

标签: node.js npm discord discord.js gcloud


【解决方案1】:

尝试安装所需的包discord.js-commando。它不在 package.json 中。你可以用npm install discord.js-commando --save安装它

【讨论】:

  • 哇,我傻了。那行得通。感谢您的帮助!
猜你喜欢
  • 2018-05-26
  • 1970-01-01
  • 1970-01-01
  • 2017-08-24
  • 2018-08-17
  • 2012-08-07
  • 2020-10-13
  • 2021-10-17
  • 2021-11-25
相关资源
最近更新 更多