Skip to content

Unable to start ts-node on Windows #606

@AleksandarAleksandrov

Description

@AleksandarAleksandrov

I'm using nodemon to watch for changes in my project.
In the nodemon.json file I have the following configuration:

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

When trying to start the server nodemon server/index.ts , this is the error I get:

> 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 (C:\pp\habit\web\node_modules\ts-node\dist\index.js:83:45)    at Object.<anonymous> (C:\pp\habit\web\node_modules\ts-node\dist\bin.js:64:30)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)    at Function.Module._load (internal/modules/cjs/loader.js:543:3)    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)    at startup (internal/bootstrap/node.js:238:19)
[nodemon] app crashed - waiting for file changes before starting...

It seems the compilerOptions are not being passed to the command on windows. Any idea how to solve this 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions