Truffle:"Invalid or unexpected token" when 运行 promise 函数
Truffle: "Invalid or unexpected token" when running promise function
当我 运行 truffle 控制台中的任何函数时,它 returns "Invalid or unexpected token."
这是完整的错误 return:
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 上的一个 Windows 特定问题,可能与编码有关。
在 Windows 10 上使用 Bash 可以轻松避免此类问题。
https://docs.microsoft.com/en-us/windows/wsl/install-win10
当我 运行 truffle 控制台中的任何函数时,它 returns "Invalid or unexpected token."
这是完整的错误 return:
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 上的一个 Windows 特定问题,可能与编码有关。
在 Windows 10 上使用 Bash 可以轻松避免此类问题。 https://docs.microsoft.com/en-us/windows/wsl/install-win10