在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");