找不到模块:无法解析web3无法解析松露合同

时间:2017-12-17 19:29:06

标签: webpack blockchain solidity truffle web3js

当我运行命令npm run dev时,它给了我这个错误,我尝试了几次安装web3的各种版本以及松露合同但每次都给我同样的错误。

确切错误:

ERROR in ./app/javascripts/app.js
Module not found: Error: Can't resolve 'truffle-contract' in 'C:\Users\Siddharth\Desktop\SID\ALSC\PROJECT\asset-lending\app\javascripts'
 @ ./app/javascripts/app.js 6:1-55
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./app/javascripts/app.js

ERROR in ./app/javascripts/app.js
Module not found: Error: Can't resolve 'web3' in 'C:\Users\Siddharth\Desktop\SID\ALSC\PROJECT\asset-lending\app\javascripts'
 @ ./app/javascripts/app.js 5:1-39
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./app/javascripts/app.js
webpack: Failed to compile.

1 个答案:

答案 0 :(得分:0)

npm install tr​​uffle-contract它解决了这两个错误,如果它没有工作尝试全局安装,在我的情况下我在本地安装。

https://www.npmjs.com/package/truffle-contract