BlackBoxVision / typescript-hapi-starter

🚀 Starter for building APIs with Hapi + Typescript!
MIT License
128 stars 28 forks source link

Error: ''node' is not recognized as an internal or external command #10

Closed guilhermewaess closed 7 years ago

guilhermewaess commented 7 years ago

Hello, I'm trying to run you starter, but stuck on this error:

 npm run nodemon:build

> typescript-hapi-starter@1.0.0 nodemon:build C:\projetos\typescript-hapi-starter
> nodemon --exec 'node -r dotenv/config' ./node_modules/.bin/ts-node -- ./src/index.ts

[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `'node -r dotenv/config' ./node_modules/.bin/ts-node ./src/index.ts`
''node' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...

node --version v7.7.3

OS: Windows 10

Escaping the quotes, I got another error: "nodemon:build": "nodemon --exec \"node -r dotenv/config\" ./node_modules/.bin/ts-node -- ./src/index.ts",

 npm run nodemon:build

> typescript-hapi-starter@1.0.0 nodemon:build C:\projetos\typescript-hapi-starter
> nodemon --exec "node -r dotenv/config" ./node_modules/.bin/ts-node -- ./src/index.ts

[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node -r dotenv/config ./node_modules/.bin/ts-node ./src/index.ts`
C:\projetos\typescript-hapi-starter\node_modules\.bin\ts-node:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^
SyntaxError: missing ) after argument list
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:425:7)
    at startup (bootstrap_node.js:146:9)

Any clue?

guilhermewaess commented 7 years ago

Well, works if I put this on first line of index.ts:

require('dotenv').config();

But I dont know if is the best solution!

JoseLuisGarciaOtt commented 7 years ago

We have detected this problem on Windows a time ago, but since we all use linux-based systems we couldn't take the chance to dig a little more on this.

I will give it a try at home at the weekend! Thanks for the report and for the workaround ;)

JonatanSalas commented 7 years ago

@guilhermewaess I will try to review and see if we can improve this for windows users 😄. As @joseluisgarciaott said, we all use linux-based and OS X systems, so we don't give the time needed to review windows support.

JonatanSalas commented 7 years ago

There's a PR to resolve a nodemon related issue in windows. For now, the work around you made seems the only way to do the trick! Thanks for this issue and for your contribution!