skip to Main Content

I have a code base which is working perfectly fine on a Windows box on node v10.16.3 but when I try to install the same code base on a CentOS Linux box with node v.12.16.3, I get the following error. Not sure what the issue could be.

# npm start

> nest start

internal/modules/cjs/loader.js:960
  throw err;
  ^

Error: Cannot find module '@angular-devkit/core'
Require stack:
  - /usr/local/lib/node_modules/@nestjs/cli/lib/schematics/schematic.option.js
  - /usr/local/lib/node_modules/@nestjs/cli/lib/schematics/index.js
  - /usr/local/lib/node_modules/@nestjs/cli/actions/generate.action.js
  - /usr/local/lib/node_modules/@nestjs/cli/actions/index.js
  - /usr/local/lib/node_modules/@nestjs/cli/commands/command.loader.js
  - /usr/local/lib/node_modules/@nestjs/cli/commands/index.js
  - /usr/local/lib/node_modules/@nestjs/cli/bin/nest.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> 
(/usr/local/lib/node_modules/@nestjs/cli/lib/schematics/schematic.option.js:3:16)
  at Module._compile (internal/modules/cjs/loader.js:1133:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
  at Module.load (internal/modules/cjs/loader.js:977:32)
  at Function.Module._load (internal/modules/cjs/loader.js:877:14)
  at Module.require (internal/modules/cjs/loader.js:1019:19) {
  code: 'MODULE_NOT_FOUND',
requireStack: [
  '/usr/local/lib/node_modules/@nestjs/cli/lib/schematics/schematic.option.js',
  '/usr/local/lib/node_modules/@nestjs/cli/lib/schematics/index.js',
  '/usr/local/lib/node_modules/@nestjs/cli/actions/generate.action.js',
  '/usr/local/lib/node_modules/@nestjs/cli/actions/index.js',
  '/usr/local/lib/node_modules/@nestjs/cli/commands/command.loader.js',
  '/usr/local/lib/node_modules/@nestjs/cli/commands/index.js',
  '/usr/local/lib/node_modules/@nestjs/cli/bin/nest.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Exit status 1
npm ERR!
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-05-22T14_14_24_709Z-debug.log

3

Answers


  1. Delete the dist folder and again run yarn start, npm start, yarn start:dev or npm run start:dev to rebuild the dist folder. In addition yarn prebuild or npm run prebuild does the same thing using rimraf

    The problem occurs when you change a name and the tsc does not change it in dist and transpiled .js files, so it cannot find the module

    I think to the best of my knowledge, nestjs or tsc does that to make the transpilation faster

    Login or Signup to reply.
  2. Nothing else worked for me but the following did:

    npm install --save-dev webpack
    

    i’m not completely sure if there is any adverse impact to this though

    Login or Signup to reply.
  3. most important where you started node js the dist/ or / build folder has a worng path which we import or required so for
    NPM : npm install –save-dev webpack
    and for yarn add webpack this one packeg will slove your problem

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search