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

Typescript custom server example is broken #4580

Closed
AleksandarAleksandrov opened this issue Jun 10, 2018 · 4 comments
Closed

Typescript custom server example is broken #4580

AleksandarAleksandrov opened this issue Jun 10, 2018 · 4 comments

Comments

@AleksandarAleksandrov
Copy link

Typescript custom server example is broken

Example name

custom-server-typescript

Describe the bug

When launching the demo with yarn run dev the following error is displayed:

D:\temp\custom-server-typescript> npm run dev
> @ dev D:\temp\custom-server-typescript
> nodemon server/index.ts

[nodemon] 1.17.5[nodemon] to restart at any time, enter `rs`
[nodemon] watching: server/**/*.ts
[nodemon] starting `ts-node --compilerOptions '{"module":"commonjs"}' server/index.ts`
undefined:1
'{module:commonjs}'
^

SyntaxError: Unexpected token ' in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.parse (D:\temp\custom-server-typescript\node_modules\ts-node\dist\index.js:53:25)
    at Object.<anonymous> (D:\temp\custom-server-typescript\node_modules\ts-node\dist\_bin.js:92:30)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:194:16)
[nodemon] app crashed - waiting for file changes before starting...

To Reproduce

Clone the example repository, install the dependencies and type yarn run dev

Expected behavior

The example shoud work.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: [Windows 10]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of Next.js: [latest]

Additional context

Add any other context about the problem here.

@billnbell
Copy link

+1

@AleksandarAleksandrov
Copy link
Author

Tried the answer here - #4543

Namely: npx babel-upgrade --write which added babel-core@^7.0.0-bridge.0
but this didn't have any effect either 😞

@AleksandarAleksandrov
Copy link
Author

It seems the problem was from the fact that windows power shell escapes the " character.
For windows the nodemon.json file should be :

{
    "watch": [
        "server/**/*.ts"
    ],
    "execMap": {
        "ts": "ts-node --compilerOptions {\"\"\"module\"\"\":\"\"\"commonjs\"\"\"}"
    }
}

PS: Please close the issue.

@rohmanhm
Copy link
Contributor

Is this issue resolved?
If yes, now you can close the issue then.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants