title: Typescript/Node: Error [ERR_MODULE_NOT_FOUND]: Cannot find module
body: <p>I'm seeing the error I specified in my title and none of the existing solutions here seem to help, so I'm hoping someone can give me insight as to what is going on.</p>
  <p>I am using Typescript and Node in my project. TS compiles everything just fine...I end up with the following as expected:</p>
  <pre><code>projectHome/
     dist/
        schema/
            schema.js
        index.js
  </code></pre>
  <p>When I run <code>node ./dist/index.js</code> from project home, I get the error
  cannot find module '/home/me/projectHome/dist/schema/schema' imported from '/home/me/projectHome/dist/index.js'</p>
  <p>Relative imports in index.js are as follows:</p>
  <pre><code>    import express from 'express';
      import { ApolloServer } from 'apollo-server-express';
      import typeDefs from './schema/schema';
  </code></pre>
  <p>My schema.ts file contains:</p>
  <pre><code>    import { ApolloServer, gql } from 'apollo-server-express'
      import { GraphQLScalarType } from 'graphql'
  
          const typeDefs = gql`
             ...(edited for brevity/sanity)
          `
  
      export default typeDefs
  </code></pre>
  <p>and my typescript file (should this matter at this point since it is Node that is failing??) looks like this:</p>
  <pre><code>    {
          &quot;compilerOptions&quot;: {
          &quot;target&quot;: &quot;ES6&quot;,                         
          &quot;module&quot;: &quot;ES6&quot;,                         
          &quot;lib&quot;: [&quot;ES6&quot;],                          
          &quot;allowJs&quot;: true,                         
          &quot;sourceMap&quot;: true,                       
          &quot;outDir&quot;: &quot;./dist&quot;,                      
          &quot;rootDir&quot;: &quot;./src&quot;,                      
          &quot;strict&quot;: true,                          
          &quot;skipLibCheck&quot;: true,                    
          &quot;forceConsistentCasingInFileNames&quot;: true 
      },
  
      &quot;files&quot;: [&quot;src/@types/graphql.d.ts&quot;],
      &quot;include&quot;: [&quot;src/**/*&quot;, &quot;serverInfo.json&quot;],
      &quot;exclude&quot;: [&quot;node_modules&quot;, &quot;**/*.spec.ts&quot;]
      }
  </code></pre>
  <p>Note that I cannot use commonjs because some objection related code fails when I do.  Is the problem actually related to using ES6 modules, or is something else wrong?</p>
  <p>Thank in advance!</p>
  <p>-Chris</p>