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.

run-many appends a "--" argument when invoking packages' scripts

See original GitHub issue

Current Behavior

In a monorepo where each package has a tsc script to run the Typescript checker, when I run tsc through Nx using this command:

nx run-many --target=tsc --all --skip-nx-cache

Nx appends -- when it invokes the scripts, and that results in the following error:

> nx-bug@1.0.0 tsc /Users/pepicrft/Downloads/nx-bug
> nx run-many --target=tsc --all --skip-nx-cache



    ✖  nx run project:tsc
       > project@1.0.0 tsc /Users/pepicrft/Downloads/nx-bug/packages/project
       > tsc -p './tsconfig.json' "--"
       
       error TS5023: Unknown compiler option '--'.

Expected Behavior

I’d expect Nx to invoke the script as it is declared in the package without appending additional arguments.

Steps to Reproduce

  1. Download this project nx-bug.zip
  2. Install dependencies pnpm install.
  3. Run pnpm run tsc

Failure Logs

The code is included above

Environment

Node : 16.13.2
   OS   : darwin arm64
   pnpm : 7.0.0
   
   nx : 14.0.5
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.0.5
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.0.5
   @nrwl/js : Not Found
   @nrwl/linter : 14.0.5
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.0.5
   typescript : 4.6.4
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
kevinsperrinecommented, May 4, 2022

I worked around it by simply adding an && echo to the end of my tsc commands… ie: "build": "node scripts/build.js && tsc --declaration --emitDeclarationOnly && echo"

1reaction
Methuselah96commented, May 16, 2022

@melMass I just created a PR to fix this, so maybe you can hold on for a little longer. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I run multiple npm scripts in parallel? - Stack Overflow
Use a package called concurrently. npm i concurrently --save-dev. Then setup your npm run dev task as so: "dev": "concurrently --kill-others \"npm run ......
Read more >
Handling Command-line Arguments in NPM Scripts
The -- notation tells your script to pass the parameters to the current command invoked by NPM. From the NPM docs: "NPM will...
Read more >
Parallelising Jobs with GNU Parallel - RONIN BLOG
This means that you can run multiple commands or scripts simultaneously, completing many jobs in the same time it takes to run one....
Read more >
Processing Linux Commands in Parallel | Baeldung on Linux
First, let's create a simple script that we'll run in parallel. ... We specify the number of arguments per call using the -n...
Read more >
package manual page - Tcl Built-In Commands
If the script argument is omitted, the current script for version version of ... when the command is invoked during a package require...
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