question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for npm scripts which call npm packages

See original GitHub issue

Try to run this on /0xProject/contracts. The tests run as is without issue (using npm run test, but throw an error when called via solidty-coverage. It seems to have something to do with the npm scripts:

"transpile": "rm -rf ./transpiled; copyfiles ./build/**/* ./transpiled; tsc",
"test": "npm run transpile; truffle test",

Error message:

Launching test command (this can take a few seconds)...

> 0x-smart-contracts@1.0.0 test /Users/primary/Projects/0x_contracts/coverageEnv
> npm run transpile; truffle test


> 0x-smart-contracts@1.0.0 transpile /Users/primary/Projects/0x_contracts/coverageEnv
> rm -rf ./transpiled; copyfiles ./build/**/* ./transpiled; tsc

sh: copyfiles: command not found
sh: tsc: command not found

npm ERR! Darwin 16.6.0
npm ERR! argv "/Users/primary/.nvm/versions/node/v7.10.0/bin/node" "/Users/primary/.nvm/versions/node/v7.10.0/bin/npm" "run" "transpile"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0

I also tried changing the script to

rm -rf ./transpiled; ./node_modules/.bin/copyfiles ./build/**/* ./transpiled; ./node_modules/.bin/tsc

This gets me a new error, which seems closer to success:

error TS5023: Unknown compiler option 'baseUrl'.
error TS5023: Unknown compiler option 'allowJs'.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:27 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
cgeweckecommented, Jul 13, 2017

Sadly I’m not making too much headway on this. . . Some of the errors are being triggered by network stuff that’s hardcoded into the migrations files - there are places there where the testing environment network is assumed to be ‘development’. That stuff is fixable / hackable.

But the signing? Is there any way that you can ask them about their signing protocol and if they are dependent on ethereumjs-util@4.x.x? Just plugging in an earlier version of the utils isn’t working.

There was significant change to the way things are signed this spring - see this ethereumjs-util PR and I think testrpc-sc is current in that regard, but I need to verify that and will write a test for it tomorrow. It’s really important.

1reaction
cgeweckecommented, Jul 6, 2017

I’m going to close because the question about how to call node packages from scripts is basically resolved. However - I’m adding 0xProject to the list of installation targets to test. And think an addendum to the README might be in order here because how to handle this issue is not super clear.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm-run-script
This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts. run[-script] is...
Read more >
Running cross-platform tasks via npm package scripts - 2ality
The npm package manager lets us define small shell scripts for tasks and execute them via npm run. In this blog post, we...
Read more >
Sending command line arguments to npm script - Stack Overflow
The purpose of start-script.json is to read default.package.json , extract the scripts and look for npm run scriptname then append the passed ...
Read more >
Helpers and tips for npm run scripts - Michael Kühnel
You can easily run scripts using npm by adding them to the "scripts" field in package.json and run them with npm run <script-name>...
Read more >
Using Npm Scripts as a Build Tool in 2022 - Delicious Brains
Once you define your scripts in your package.json , npm has a run command that can execute these scripts. If you've ever used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found