Search code examples
node.jstypescriptts-node

Cannot find module ts-node - assuming path or parcel is the problem


I'm trying to run swell/svala. After running yarn and using yarn run serve the app starts but throws an error:

× Cannot find module 'path\to\svala$(ts-node' from 'path\to\svala'

This project is foreign to me and I've never worked with ts-node and parcel. After doing a bunch of googling, most links leads to SO Q&A, where the main culprit is usually the path.

This is the relevant command found in package.json

    "serve": "parcel $(ts-node src/generate_index.ts ${App:-Editor})",

I've also tried changing the command to include the "correct path", but I get almost the same error mesagge.

    "serve": "parcel $(node_modules/ts-node src/generate_index.ts ${App:-Editor})",

× Cannot find module 'path\to\svala$(node_modules\ts-node' from 'path\to\svala'

The problem might not be the path, but something with parcel, but I have no idea what $( ... ) is supposed to do.

Like I said, I'm not really sure whats going on here, so I would like to ask for help resolving this problem.

Module ts-node is located inside svala\node_modules\ts-node

This is tsconfig-json

{
  "compilerOptions": {
    "outDir": "./dist",
    "sourceMap": true,
    "noImplicitAny": true,
    "strict": true,
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "jsx": "react",
    "lib": ["es2017", "dom"],
    "noEmitOnError": true,
    "allowUnreachableCode": true,
    "keyofStringsOnly": true,
    "resolveJsonModule": true,
    "esModuleInterop": true
  },
  "include": ["src", "test"],
  "parcelTsPluginOptions": {
    "transpileOnly": false
  }
}

If I can provide any additional information, please let me know.

Thank you

Edit 1: As requested, adding stacktrace.

×  Cannot find module path\to\svala\$(ts-node' from 'path\to\svala'
    at Resolver.resolve (path\to\svala\node_modules\parcel-bundler\src\Resolver.js:76:17)
    at async Bundler.resolveAsset (path\to\svala\node_modules\parcel-bundler\src\Bundler.js:308:23)
    at async Bundler.bundle (path\to\svala\node_modules\parcel-bundler\src\Bundler.js:182:26)

Solution

  • I had to install ubuntu to run yarn. Then everything worked. I guess it's not compatibile with windows (rm and such)