Guide on using ExpressJS and RethinkDb: Dealing with the error message "Cannot read property 'prototype' of undefined"

Just starting out with databases and JavaScript, I decided to dive into learning ExpressJS and RethinkDB using a tutorial provided by this link:

https://github.com/rethinkdb/rethinkdb-example-nodejs-chat

Following the instructions closely, I encountered an error related to basic module loading. It seems like there might be a dependency issue or perhaps I missed a step.

After successfully setting up RethinkDB as instructed, I was able to access the database explorer at:

http://localhost:8080

However, when I ran node app as directed in the tutorial, I received the following error message. Any assistance with this problem would be greatly appreciated:

/Users/test/rethinkdb-example-nodejs-chat/node_modules/socket.io/lib/store.js:35
Store.prototype.__proto__ = EventEmitter.prototype;
                                         ^

TypeError: Cannot read property 'prototype' of undefined
    at Object.<anonymous> (/Users/test/rethinkdb-example-nodejs-chat/node_modules/socket.io/lib/store.js:35:42)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/test/rethinkdb-example-nodejs-chat/node_modules/socket.io/lib/manager.js:16:13)
    at Module._compile (module.js:643:30)

Answer №1

Node.js has deprecated process.EventEmitter and it is not functioning correctly in newer versions. For a solution, you can refer to this link

Consider reverting back to an older version of Node.js to see if the tutorial runs successfully.

Here is more information on the issue

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Leveraging clusters in Node.js for REST API deployment

Within my node.js application, I have a REST API that contains complex logic with extensive looping, taking over 7 seconds to complete. As the loop count may increase in the future, the processing time is bound to increase as well. To optimize performance ...

Error: The property 'case sensitive routing' cannot be accessed because it is undefined

Task at hand: Running ExpressJS port using Node.js, nodemon, and lib. Operating System: Windows 10 Home x64 Node.JS Version: Lts The Challenge: Getting the ExpressJS port to run successfully. Current Issue: Encountering an internal file error, potentiall ...

Is it possible to run both Express and React on the same port within the MERN Stack

Currently, I am working on a project that utilizes the MERN stack - MongoDB, Express, React, and Node. However, I have encountered an issue when attempting to post data from a form in a React component to an API endpoint defined in Node.js. Upon submission ...

Providing arguments to mocha while executing through npm

I'm currently setting up nyc/mocha for my project and I need to pass the --exit option to mocha when running it with or without nyc. Below is a snippet from my package.json file: "scripts": { "start": "node ./app", "test": "./node_modules/.b ...

Steps to create a private route in Express:

In my current project, I am utilizing a nodejs/express application as the backend solution. This application incorporates passport-jwt to secure specific routes using JWT as the header Authorization. One of these secured routes, known as secure-route, need ...

What is the best way to use multiple encoding types when sending data via a POST method in Node.js?

My current challenge involves sending a combination of name and description text data alongside a video file. Unfortunately, I've encountered an issue where I can only send either the video or the text, but not both simultaneously. Below is the code ...

Enable users to designate custom methods as either asynchronous or synchronous

These are my TypeScript method signatures: onPinnedError?(info: HavenInfo, req: Request, res: Response): HookReturnType; async onPinnedError?(info: HavenInfo, req: Request, res: Response): HookReturnType; onPinnedUnhandledRejection?(info: HavenInfo, ...

Encountering connection closure while using the http GET method in a Node.js application with Express framework

My issue involves receiving a connection close header in response when making a GET request, but the connection remains keep-alive for POST requests. My current setup includes an AWS ALB directing traffic to EKS. Within EKS, there is an NGINX ingress rout ...

Is there a way to configure json-server, when utilized as a module, to introduce delays in its responses

json-server provides a convenient way to introduce delays in responses through the command line: json-server --port 4000 --delay 1000 db.json However, when attempting to achieve the same delayed response using json-server as a module, the following code ...

What do I need to know about file formats and canceling uploads?

#1 I came across some information in the formidable documentation indicating that we can filter file types: const options = { filter: function ({name, originalFilename, mimetype}) { // only keep images return mimetype && mimetype.includes ...

Saving this object in Mongodb - here's how it's done

click here for imageCan you provide guidance on creating a schema and saving API data for this specific object in MongoDB? I am looking to store the information related to 'btcinr' as it will be fetched from an external API. Below is the sample ...

What is the best way to configure multiple environmental variables in webpack?

I'm having trouble figuring out how to pass multiple environment variables to webpack. I've been attempting to execute the script below, but it doesn't seem to be working: "cross-env NODE_ENV=production DTM_ENV=staging webpack --config ...

Node.js has the ability to establish internal connections, however it cannot establish connections

I'm having an issue connecting to a JavaScript file on my local server. I'd like to input the external IP address and port in order for it to run externally. This functionality currently works when accessed locally. Below is the code from my serv ...

What could be causing the Type Error in jsdom?

When attempting to parse a remote site using jsdom, I encountered an error when trying to use it with node-webkit.js: I received the following error: "Uncaught TypeError: A 'super' constructor call may only appear as the first statement of a f ...

I currently have an array of strings and wish to print only the lines that include a specific substring

Here i want to showcase lines that contain the following strings: Object.< anonymous > These are multiple lines: Discover those lines that have the substring Object . < anonymous > Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'you ...

Ionic Error: Module 'dezalgo' not found

When attempting to integrate the ios platform into my project for XCode development, I executed the command: ionic cordova platform add ios However, the following error occurred: ionic cordova platform add ios > cordova platform add ios --save module. ...

Issue with upgrading node from 12v to 16v: Trying to access a property that does not exist, specifically 'splice', within a circular dependency in module exports

After upgrading the node version from 12 to 16, we encountered a debugging console error. The 'Promises' are failing to resolve following this error, leading to the termination of further execution. (node:28112) Warning: Accessing non-existent p ...

What is the best way to incorporate conditionals into loops when working with Jade?

I've been working on targeting a specific element within an iteration. each category in categories .menu_category p= category.category_name The code above is in Jade and it's looping through an object called categories. As I' ...

Conditional Skipping of Lines in Node Line Reader: A Step-by-Step Guide

I am currently in the process of developing a project that involves using a line reader to input credit card numbers into a validator and identifier. If I input 10 numbers from four different credit card companies, I want to filter out the numbers from thr ...

Implementing slideDown() functionality to bootstrap 4 card-body with jQuery: A step-by-step guide

Here is the unique HTML code I created for the card section: <div class="row"> <% products.forEach(function(product){ %> <div class="col-lg-3 col-md-4"> <div class="card mb-4 shadow "> &l ...