Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.(5)

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/ Questions/Can I fix the “error: cannot find module 'express'” or not?
Next
Answered
Louis da Silva
  • 11
Louis da Silva
Asked: May 12, 20222022-05-12T11:44:21+00:00 2022-05-12T11:44:21+00:00In: javascript

Can I fix the “error: cannot find module ‘express’” or not?

  • 11

. Advertisement .

..3..

. Advertisement .

..4..

I get the error message:

Error: Cannot find module 'express'
Error: Cannot find module 'express'
  at Function.Module._resolveFilename (module.js:338:15)
  at Function.Module._load (module.js:280:25)
  at Module.require (module.js:362:17)
  at require (module.js:378:17)
  at Object.<anonymous> (/Users/feelexit/WebstormProjects/learnnode/node_modules/index.js:1:81)
  at Module._compile (module.js:449:26)
  at Object.Module._extensions..js (module.js:467:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.runMain (module.js:492:10)
 feelexits-Mac:node_modules feelexit$
feelexits-Mac:~ feelexit$ npm install
 npm ERR! install Couldn't read dependencies
 npm ERR! Error: ENOENT, open '/Users/feelexit/package.json'
 npm ERR! If you need help, you may report this log at:
 npm ERR! <http://github.com/isaacs/npm/issues>
 npm ERR! or email it to:
 npm ERR! <[email protected]>
 
 npm ERR! System Darwin 12.2.0
 npm ERR! command "/Users/feelexit/nvm/v0.8.20/bin/node" "/Users/feelexit/nvm/v0.8.20/bin/npm" "install"
 npm ERR! cwd /Users/feelexit
 npm ERR! node -v v0.8.20
 npm ERR! npm -v 1.2.11
 npm ERR! path /Users/feelexit/package.json
 npm ERR! code ENOENT
 npm ERR! errno 34
 npm ERR! 
 npm ERR! Additional logging details can be found in:
 npm ERR! /Users/feelexit/npm-debug.log
 npm ERR! not ok code 0

Has anyone ever faced this problem? How to troubleshoot the “ error: cannot find module ‘express’”
But the problem is appearing when I try to operate the following program

node.js: 0.8.20 path to node: /Users/feelexit/nvm/v0.8.20/bin/node
 path to express: /Users/feelexit/nvm/node_modules/express
var express = require('express');
 var app = express();
 app.get('/', function(req, res){
  res.send('welcome to express');
 });
 app.listen(3000);

cannot find module
  • 2 2 Answers
  • 91 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Best Answer
    lyytutoria Expert
    2022-06-01T00:25:47+00:00Added an answer on June 1, 2022 at 12:25 am

    The cause: This error occurs because of missing permissions or unlinked files while npm was working. It means that executing npm as this user doesn’t have enough rights to read or write from a file, in this case is package.json.

    Solution: Adding sudo before the entire command:

    $ sudo npm install -g express
    $ Password:*******

    Password would be your admin password of your mac.

    -g flag will set up this module (express) in the global context of node, it means that node will recognize express module from within any js file without providiing a full path to the module in use.

    • 6
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Agathe Tanguy
    2022-05-25T19:46:57+00:00Added an answer on May 25, 2022 at 7:46 pm

    It is a statement of fact

    Cannot find module 'express'

    Are you running express? If you don’t, then follow this.

    npm install express

    Run your program again.

    • 14
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • How to Split String by space in C++
  • How To Convert A Pandas DataFrame Column To A List
  • How to Replace Multiple Characters in A String in Python?
  • How To Remove Special Characters From String Python

Explore

  • Home
  • Tutorial

Footer

ITtutoria

ITtutoria

This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

@ ITTutoria Co Ltd.

Tutorial

  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA

Legal Stuff

  • About Us
  • Terms of Use
  • Privacy Policy
  • Contact Us

DMCA.com Protection Status

Help

  • Knowledge Base
  • Support

Follow

© 2022 Ittutoria. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.