Denison Cupidon
Sep 4, 2018 · 1 min read

Hello, Thanks for the post. I tried it but can’t get the module resolution to work.

When i execute ‘ts-node index.ts’, I ran into the following error:

Error: Cannot find module ‘@controllers
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)

tsconfig.json

{
"compilerOptions": {
/* Basic Options */
"target": "es5",
/* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs",
/* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */

"outDir": "./dist",
"sourceMap": true,
"declaration": true,
"moduleResolution": "node",
"strict": true,
"esModuleInterop": true,
"baseUrl": ".",
"paths": {
"@controllers/*": [
"src/controllers/*"
]
},
"lib": [
"es2015",
"es2016",
"es2017",
"dom"
]
},
"include": [
"./**/*"
],
"files": [
"./node_modules/@types/node/index.d.ts"
],
"exclude": [
"node_modules",
"lib/**/*.spec.ts"
]
}
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade