Error on App.contracts.TodoList = TruffleContract(todoList)



在Windows 10环境上工作

来自windows 10上的web服务器的错误:

''

Failed to load resource: the server responded with a status of 404 (Not Found)
app.js:56 Uncaught (in promise) ReferenceError: TruffleContract is not defined
at Object.loadContract (app.js:56)
at async Object.load (app.js:8)

''

错误引用的代码:

'''
loadContract: async () => {
//var contract = require("truffle-contract");
// Create a JavaScript version of the smart contract
const todoList = await $.getJSON('vote.json')
console.log(todoList)
App.contracts.TodoList = TruffleContract(todoList)
App.contracts.TodoList.setProvider(App.web3Provider)
// Hydrate the smart contract with values from the blockchain
App.todoList = await App.contracts.TodoList.deployed()
},
'''

已解决添加的var contract = required("truffle-contract");

最新更新