在 Ubuntu VPS 中执行脚本时遇到问题

在 Ubuntu VPS 中执行脚本时遇到问题

当我尝试在 VPS 中启动脚本时,出现以下错误:

line 1: syntax error near unexpected token `('
line 1: `var Steam = require("steam");

我正在做bash donation.js。这是脚本的开头:

var Steam = require("steam");
var SteamUser = require ("steam-user");
var client = new SteamUser();
var SteamTotp = require('steam-totp');

var friends = new Steam.SteamFriends(client.client);

var SteamCommunity = require('steamcommunity');
var community = new SteamCommunity();

var client;

var SteamID = require("steamid");

var TradeOfferManager = require('steam-tradeoffer-manager');
var fs = require('fs');
var request = require('request');

var SteamTrade = require("steam-trade");
var steamTrade = new SteamTrade();

var manager = new TradeOfferManager({
    "steam": client,
    "domain": "example.com",
    "language": "en"

我怎样才能做到这一点?

答案1

您正在尝试使用 bash 运行 javascript,bash 是 shell 解释器,而不是 javascript。

您需要使用 node.js: 运行它node donation.js

相关内容