Error: Cannot find module 'babel-register'

Matt H. picture Matt H. · Dec 12, 2018 · Viewed 22.6k times · Source

I am currently working on a projects that involves making an oracle connecting to an express back-end. The environment was already implemented and pushed to a repository on github. I cloned the project and ran npm install to get all the packages needed for the project. Then I tried to run the project and got this error:

module.js:550
   throw err;
   ^

Error: Cannot find module 'babel-register'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\xxxx\xxxx\Documents\Work\ef-backend\bin\www:1:63)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
[nodemon] app crashed - waiting for file changes before starting...

I then proceeded npm install babel-register thinking maybe the package made it into the gitignore. After the package was installed, I tried to run the project once more and continued to get the same error.

Answer

Matt H. picture Matt H. · Dec 12, 2018

I have resolved this issue myself, it was actually an issue with package-lock file being out of sync with the package file. I deleted the package-lock file and npm installed. This then allowed my project to run correctly.