You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ pwd
/home/ravi/repo/erc20/zeppelin-hitchhiker-guide
$ npm bin
/home/ravi/repo/erc20/node_modules/.bin
Here is the error I get:
$ $(npm bin)/solidity-coverage
Generating coverage environment
Instrumenting ./coverageEnv/contracts/ConvertLib.sol
Instrumenting ./coverageEnv/contracts/MetaCoin.sol
Skipping instrumentation of ./coverageEnv/contracts/Migrations.sol
Instrumenting ./coverageEnv/contracts/ProofOfExistence1.sol
testRpc stderr:
/bin/sh: ./node_modules/.bin/testrpc-sc: No such file or directory
Cleaning up...
testRpc errored after launching as a childprocess.
Exiting without generating coverage...
$
@HaleTom We used to use /.bin but it broke yarn based installations. In the example you give, why is node_modules nested within erc20? To keep things simple we expect it to be in the root directory of the project
@cgewecke I have a few different projects under erc20.
Perhaps I don't fully understand the placement of the node_modules directory, but I assume that whatever npm thinks is the bin directory would be the one to use, to allow for directory structure flexibility.
@HaleTom That's reasonable but yarn won't install subdep binaries (I think - idk if they fixed this or something). We're at the planning stages of a refactor which will eviscerate all of the crazy stuff like childprocess.exec from app.js but it's not going to happen super soon.
In the interim one workaround is to set norpc to true in the .solcover.js config file and launch testrpc-sc separately from a shell script. That will let you control the path however you choose.
Example of this approach at zeppelin-solidity here
If you want to use it as a command line tool, something like the grunt CLI, then you want to install it globally. On the other hand, if you want to depend on the package from your own module using something like Node's require, then you want to install locally.
Because I want to use solidity-coverage at the command line, I installed it globally.
So, following the docs, ./node_modules/.bin/testrpc-sc won't work.
Could we assume that the user has setup their $PATH correctly and execute it without a leading path?
Activity
HaleTom commentedon Oct 5, 2017
Work around:
In the directory where npm-modules is expected, run:
cgewecke commentedon Oct 5, 2017
@HaleTom We used to use
/.binbut it brokeyarnbased installations. In the example you give, why isnode_modulesnested withinerc20? To keep things simple we expect it to be in the root directory of the projectHaleTom commentedon Oct 5, 2017
@cgewecke I have a few different projects under
erc20.Perhaps I don't fully understand the placement of the
node_modulesdirectory, but I assume that whatevernpmthinks is thebindirectory would be the one to use, to allow for directory structure flexibility.cgewecke commentedon Oct 5, 2017
@HaleTom That's reasonable but
yarnwon't install subdep binaries (I think - idk if they fixed this or something). We're at the planning stages of a refactor which will eviscerate all of the crazy stuff likechildprocess.execfromapp.jsbut it's not going to happen super soon.In the interim one workaround is to set
norpcto true in the.solcover.jsconfig file and launch testrpc-sc separately from a shell script. That will let you control the path however you choose.Example of this approach at zeppelin-solidity here
HaleTom commentedon Oct 6, 2017
FYI, yarn does have a selective version resolution feature.
The npm doco says:
Because I want to use
solidity-coverageat the command line, I installed it globally.So, following the docs,
./node_modules/.bin/testrpc-scwon't work.Could we assume that the user has setup their $PATH correctly and execute it without a leading path?
cgewecke commentedon Oct 6, 2017
Oh that's an important point you raise. I've never actually tried to install it globally. But yeah, we absolutely assume it's a local dep. . .
cgewecke commentedon Oct 7, 2017
Renaming this issue and filing under
enhancement.[-]Don't hard-code `testrpc-sc` location[/-][+]Enable global npm installation[/+]