Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using npx tsc-watch ... in scripts fails to find tsconfig #125

Closed
nawlbergs opened this issue Aug 30, 2021 · 4 comments
Closed

Using npx tsc-watch ... in scripts fails to find tsconfig #125

nawlbergs opened this issue Aug 30, 2021 · 4 comments

Comments

@nawlbergs
Copy link

nawlbergs commented Aug 30, 2021

Suddenly this morning, Im having problems with tsc-watch while using npx to target nodes bin dir. No idea why.. it worked Friday.. now (on monday) my server was not starting. (i did restart windows).. so maybe windows updated something.... but heres what my team is using in package:

"wtf1": "    tsc-watch --noClear -p ./tsconfig.json --onSuccess \"cross-env NODE_ENV=local node ./dist/app.js\"", // works
"wtf2": "npx tsc-watch --noClear -p ./tsconfig.json --onSuccess \"cross-env NODE_ENV=local node ./dist/app.js\"", // error
"wtf3": "    tsc-watch --noClear --onSuccess \"cross-env NODE_ENV=local node ./dist/app.js\"", // works
"wtf4": "npx tsc-watch --noClear --onSuccess \"cross-env NODE_ENV=local node ./dist/app.js\"",  // error

results in:

wtf1: works
wtf2: error TS5042: Option 'project' cannot be mixed with source files on a command line.
wft3: works
wtf4: error TS6504: File 'dist/app.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? ..

our original command we use in our project is wtf4

@gilamran
Copy link
Owner

gilamran commented Aug 30, 2021

Is this your package.json scripts?
Also, why are you using npx inside the package.json?

Another thing, can you try and just use tsc instead and see if it works (Remove the onSuccess)

@nawlbergs
Copy link
Author

Yes in package.json sorry.
I generally just use npx everywhere. Its what are team just does.. it forces usage of the installed bin from package. (like.. instead of a global version or etc etc).

"runJustTsc": "npx tsc" // builds as expected.  

running any other command with npx inside package.json seems to work fine... and last week.. this worked for tsc-watch as well.... so im just trying to figure out what changed. :) This has not effected our team (tho they are on macs and im the only one using a pc right now)

@gilamran
Copy link
Owner

gilamran commented Sep 2, 2021

It happens only on windows?

@gilamran
Copy link
Owner

gilamran commented Sep 5, 2021

Looks like there are several issues reported to npx:
npm/npx#10
npm/npx#43
eslint/eslint#13733

@gilamran gilamran closed this as completed Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants