5

I am working on running my express server with the command npm start. I am receiving: ```node:internal/modules/cjs/loader:942 throw err; ^

Error: Cannot find module 'express' Require stack: ```.

I currently do not have node modules and also receive errors when I type the command npm install. I've deleted node modules outside of the current directory, upgraded the version, & have been googling answers. I would appreciate the help. Thanks so much!

Andrea Everett
  • 349
  • 2
  • 4
  • 4

3 Answers3

1

You need to install express as the error is showing that express is missing. The command for that shall be npm install express --save. You have also mentioned that you are receiving error upon running npm install .

Updated

Remove bycrypt-nodejs from your package.json file as it is deprecated. Then run npm install. If you need bycrypt you can run npm install bcrypt or npm install bcryptjs which suits your project better. Afterwards run npm install express --save. Hope this will solve the issue.

  • Thank you for the response! When I type npm install express --save, I receive this error: npm WARN deprecated bcrypt-nodejs@0.0.3: bcrypt-nodejs is no longer actively maintained. Please use bcrypt or bcryptjs. See https://github.com/kelektiv/node.bcrypt.js/wiki/bcrypt-vs-brypt.js to learn more about these two options npm ERR! code 1 – Andrea Everett May 21 '22 at 15:37
  • You are welcome. As my understanding goes bcrypt-nodejs is creating the problem. So my suggestion is, remove bycrpyt-nodejs from you dependencies that is from the package.json file and try to run npm install. It should work. And according to the documentation npm install bcrypt should be a replacement from bycrpt-nodejs. After wards you may run the installation for express. – Radowan Mahmud Redoy May 21 '22 at 16:36
  • @AndreaEverett i have updated my answer. Hope this will help you. – Radowan Mahmud Redoy May 22 '22 at 04:48
0

This is probably because you are in the wrong folder or your file name is wrong. Try ls to see if all your necessary packages are there. If not go to the right folder and type npm i in the terminal. This should solve the issue of any missing packages. Then use npm run start.

0

I'm still getting error

npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
avariant
  • 2,234
  • 5
  • 25
  • 33