以太坊Truffle,在 truffle init 和 truffle compile 出现:运行时错误,“module”未定义

在Windows,cmd环境下使用truffle时有时会出现

运行时错误,"module" 未定义

参见官方文档后,只需调用时写truffle.cmd即可

 

详见原文:

RESOLVING NAMING CONFLICTS ON WINDOWS

When using the Command Prompt on Windows, the default configuration file name can cause a conflict with the truffle executable, and so you may not be able to run Truffle commands properly on existing projects.

This is because of the way that command precedence works on the Command Prompt. The truffle.cmd executable is on the path as part of the npm package, but the truffle.js configuration file is in the actual directory where the truffle command is run. Because .js is an acceptable executable extension by default, truffle.js takes precedence over truffle.cmd, causing unexpected results.

Any of the following solutions will remedy this issue:

Call the executable file explicitly using its .cmd extension (truffle.cmd compile)
Edit the system PATHEXT environment variable and remove .JS; from the list of executable extensions
Rename truffle.js to something else (truffle-config.js)
Use Windows PowerShell or Git BASH, as these shells do not have this conflict.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值