【发布时间】: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 上缺少的步骤或缺少依赖项吗?
提前感谢您的帮助!
【问题讨论】:
-
你的nodejs版本是多少?
-
@WilliamChong v8.11.3
-
这个错误不会打印出意外的令牌,并且由于它适用于 OSX,它会是 Windows 特定的编码问题吗?类似stackoverflow.com/questions/50203953/…
-
在 Windows 10 上使用 Bash 是否适合您?它在运行 node.js 时避免了很多特定于 windows 的问题
-
我的意思是 win10 上基于 Ubuntu 的新 bash docs.microsoft.com/en-us/windows/wsl/install-win10
标签: node.js blockchain ethereum solidity truffle