这个问题在这里已有答案:
我有一个npm / nodejs的问题,有人可以帮我解决吗?
这是我的package.json:[https://pastebin.com/B4PVFUF5]
这是我得到的输出:[https://pastebin.com/nq9muxr1]
亲切的问候,鲁本
编辑:在Gari Singh解决问题后,我得到了以下输出:[https://pastebin.com/9HMSLCtZ]
有人能帮我吗?
查看您发布的错误日志的第7行:
/app/bin/support.js: 1: /app/bin/support.js: Syntax error: "(" unexpected
目前还不清楚你到底想要做什么?您是否只是尝试将其作为应用运行,但使用“npm start”开始?
编辑:所以我看了你的回购,但有一些错误。你在package.json中缺少一些依赖项(telegraf,mysql,cron):
"dependencies": {
"cron": "^1.3.0",
"debug": "^3.0.0",
"mysql": "^2.15.0",
"node-fetch": "^1.6.3",
"sandwich-stream": "^1.0.0",
"telegraf": "^3.17.2"
},
而且你也不应该把你的包命名为“telegraf”,因为它会在试图安装实际的telegraf包时发生冲突:
{
"name": "telegraf-bot",
"version": "3.17.2",
"description": "📡 Modern Telegram bot framework",
"license": "MIT",
"author": "Vitaly Domnikov <[email protected]>",
"homepage": "https://github.com/telegraf/telegraf#readme",
"repository": {
"type": "git",
"url": "https://github.com/Flintstone2020/telegram-support-bot"
},
bin/support.js
也没有正确要求mysql:
#!/usr/bin/env node
var mysql = require("mysql")
const Telegraf = require("telegraf")
并且start命令应该只是bin / support.js:
"scripts": {
"lint": "eslint .",
"test": "ava test",
"precommit": "npm run lint && npm test",
"start": "node bin/support.js"
},
通过上述更改,npm start
对我来说很好,除了当然它无法连接到数据库。如果未设置属性,您可能希望删除使其成为可选的db部分