【问题标题】:Truffle: "Invalid or unexpected token" when running promise function松露:运行承诺功能时出现“无效或意外的令牌”
【发布时间】:2018-07-27 15:03:38
【问题描述】:

当我在 truffle 控制台中运行任何函数时,它会返回“无效或意外令牌”。

这是完整的错误返回:

truffle(development)> app.candidates(1).then(function(c) {candidate = c;})
SyntaxError: Invalid or unexpected token
at REPLServer.Interface._onLine (readline.js:280:10)
at REPLServer.emit (events.js:211:7)
at emitOne (events.js:116:13)
at REPLServer.onLine (repl.js:468:10)
at REPLServer.runBound [as eval] (domain.js:314:12)
at bound (domain.js:301:14)
at ReplManager.interpret (C:\Users\Jakob\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\lib\repl.js:119:1)
at Console.interpret (C:\Users\Jakob\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\lib\console.js:164:1)
at Object.runInContext (vm.js:119:10)
at createScript (vm.js:80:10)

我刚刚按照 YouTube 上的教程开始了我的第一个 dApp 项目,对此我还很陌生。如果需要更多信息,请询问,我会帮助您。

到目前为止,我在我的 Mac OSX 上尝试了相同的设置,并且效果非常好。这可能是我在 Windows 上缺少的步骤或缺少依赖项吗?

提前感谢您的帮助!

【问题讨论】:

标签: node.js blockchain ethereum solidity truffle


【解决方案1】:

虽然它并没有真正回答为什么会出现语法错误,但它似乎是 node.js 上的 Windows 特定问题,可能与编码有关。

在 Windows 10 上使用 Bash 可以轻松避免此类问题。 https://docs.microsoft.com/en-us/windows/wsl/install-win10

【讨论】:

    猜你喜欢
    • 2021-01-01
    • 2021-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-21
    • 1970-01-01
    相关资源
    最近更新 更多