truffle exec does not handle require statements properly
See original GitHub issueSummary: truffle exec <example_script>
does not properly handle require
statements for local node modules in example_script.
Details: truffle exec
uses the function at https://github.com/ConsenSys/truffle/blob/master/lib/require.js#L38 to handle require statements. However, if a local module is required, the line at https://github.com/ConsenSys/truffle/blob/master/lib/require.js#L53 assumes that the node_modules
directory is present in the same directory as the script being executed, rather than searching upward for the root of the node package before looking for node_modules
.
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (7 by maintainers)
Top Results From Across the Web
Truffle - a proper way to execute a chunk of code
Let's say I have a complex operation to execute, for example deploying 6 contracts and calling functions to each one, passing addreses to...
Read more >Proper use of artifacts.require? - Stack Overflow
From this I infer that the globally scoped artifacts with its method require are automatically defined by the truffle executable tool when doing ......
Read more >ConsenSys/truffle - Gitter
I'm having an issue using the @truffle/config npm package. It appears that it depends on @truffle/events , which uses the ora package but...
Read more >Write Solidity tests - Truffle Suite
You can easily test if your contract should or shouldn't raise an exception (i.e., for require() / assert() / revert() statements; throw on...
Read more >Truffle documentation - Read the Docs
This file comes with every Truffle project, and is usually not edited. ... To use only ContractTwo, your artifacts.require() statement would ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mathcrypto maybe this helps: https://github.com/trufflesuite/truffle/issues/676 Is your script wrapped into
module.exports
See also https://truffleframework.com/docs/truffle/getting-started/writing-external-scripts