Saturday, 8 April 2017

node.js command works in terminal but fails in npm

I have got a really weird issue. I have just updated all the dev dependencies in my project and it has broken my dev:server script. Now when running it with npm or yarn I get this:

npm run dev:server

> my-proj@0.0.0 dev:server C:\Users\George\Source\Repos\my-proj
> cross-env NODE_ENV=development concurrently "tsc -w --project ./server" "nodemon server"

[2] 'server' is not recognized as an internal or external command,
[2] operable program or batch file.
[2] server exited with code 1
[0] Version 2.2.2
[0] Syntax:   tsc [options] [file ...]
[0]
[0]
[0] Examples: tsc hello.ts
[0]           tsc --outFile file.js file.ts
[0]           tsc @args.txt
[0]
[0] Options:
[0]  --allowJs                                          Allow javascript files to be compiled.
[0]  --allowSyntheticDefaultImports      
...              

tsc seems to be complaining because it doesn't understand that it should use the server directory which has its own tscofig file.

But when investigating I found that running cross-env NODE_ENV=development concurrently "tsc -w --project ./server" "nodemon server" in the exact same terminal worked fine? Which suggests this is an npm or yarn bug, however nither of those have been updated and it seems very unlikely that they have both suddenly developed the same bug!

Any ideas?

NB: I am using Windows



via George Edwards

No comments:

Post a Comment