w3tecch / express-typescript-boilerplate

A delightful way to building a RESTful API with NodeJs & TypeScript by @w3tecch
MIT License
3.31k stars 905 forks source link

Windows - broken setup/serve scripts #7

Closed Tyderion closed 7 years ago

Tyderion commented 7 years ago

Some scripts from the package.json do not work correctly on windows machines.

for example, when I run npm run setup there is an error when executing knex:

C:\path\to\project\node_modules\.bin\knex: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 Function.Module.runMain (module.js:605:10)
    at Object.<anonymous> (C:\Users\Archie\Documents\Coding\Anime-Loader\crawler-v2\node_modules\ts-node\src\_bin.ts:180:12)
    at Module._compile (module.js:571:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express-typescript-boilerplate@2.0.0-beta.1 ts-node:fast: `ts-node -F "./node_modules/.bin/knex" "migrate:latest"`
npm ERR! Exit status 1

To fix this i had to directly use node_modules/knex/bin/cli.js instead of node_modules/.bin/knex.

After that, when I try to start the app by using npm run serve :

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express-typescript-boilerplate@2.0.0-beta.1 serve: `npm run banner serve && ./node_modules/.bin/nodemon --watch 'src/**/*.ts' --watch 'src/**/*.json' --watch '.env'`
npm ERR! Exit status 1

which is triggered by nodemon. To reproduce run ./node_modules/.bin/nodemon --watch 'src/**/*.ts' in the console. I have not found a way to fix this.

If i run ./node_modules/.bin/ts-node src/app.ts the app starts normally (with a different error which has nothing to do with windows).

Further, there is an apple-specific script in nodemon.json: "restart": "osascript -e 'display notification \"restarting server\" with title \"node.js application\"'"

hirsch88 commented 7 years ago

See this issue:

2

erperejildo commented 5 years ago

@hirsch88 still not working for me