Unable to start a simple program with nodejs and express

I'm encountering some difficulties with a simple nodejs and express program.

When I try to use npm start to run node .\bin\www, I receive the following errors:

C:\Users\{USRNAME}\Desktop\projets\cdc\cdc-api>npm start

<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5a393e39773b2a331a6a746a746a">[email protected]</a> start C:\Users\{USRNAME}\Desktop\projets\cdc\cdc-api
node .\bin\www


events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:904:11)
    at Server._listen2 (net.js:1042:14)
    at listen (net.js:1064:10)
    at Server.listen (net.js:1138:5)
    at Function.app.listen (C:\Users\{USRNAME}\Desktop\projets\cdc\cdc-api\node_modules\express\lib\application.js:556:24)
    at Object.<anonymous> (C:\Users\{USRNAME}\Desktop\projets\cdc\cdc-api\bin\www:
7:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

npm ERR! <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4c2f282f612d3c250c7c627c627c">[email protected]</a> start: `node .\bin\www`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c7a4a3a4eaa6b7ae87f7e9f7e9f7">[email protected]</a> start script.
npm ERR! This is most likely a problem with the cdc-api package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node .\bin\www
npm ERR! You can get their info via:
npm ERR!     npm owner ls cdc-api
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! cwd C:\Users\{USRNAME}\Desktop\projets\cdc\cdc-api
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\{USRNAME}\Desktop\projets\cdc\cdc-api\npm-debug.log
npm ERR! not ok code 0

C:\Users\{USRNAME}\Desktop\projets\cdc\cdc-api>

Here's what the npm-debug.log contains:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c5abb5a885f4ebf1ebf7fd">[email protected]</a>
3 info using <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ef81808b8aaf99dfc1dedfc1dcdd">[email protected]</a>
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99fafdfab4f8e9f0d9a9b7a9b7a9">[email protected]</a>
7 info start <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bdded9de90dccdd4fd8d938d938d">[email protected]</a>
8 verbose unsafe-perm in lifecycle true
9 info <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1e7d7a7d337f6e775e2e302e302e">[email protected]</a> Failed to exec start script
10 error <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1e7d7a7d337f6e775e2e302e302e">[email protected]</a> start: `node .\bin\www`
10 error Exit status 8
11 error Failed at the <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e88b8c8bc5899881a8d8c6d8c6d8">[email protected]</a> start script.
11 error This is most likely a problem with the cdc-api package,
11 error not with npm itself.
11 error Tell the author that this fails on your system:
11 error     node .\bin\www
11 error You can get their info via:
11 error     npm owner ls cdc-api
11 error There is likely additional logging output above.
12 error System Windows_NT 6.2.9200
13 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error cwd C:\Users\Moucheg\Desktop\projets\cdc\cdc-api
15 error node -v v0.10.32
16 error npm -v 1.4.28
17 error code ELIFECYCLE
18 verbose exit [ 1, true ]

I've attempted various solutions from online resources like reinstalling Node and recreating package.json but nothing seems to work.

Just to mention, I'm running Windows 8.

Thank you all for your anticipated help!

Answer №1

If you encounter the "EADDRINUSE" error, it indicates that the port you are trying to utilize is currently being used by another process on your system. To resolve this issue, consider changing the port assigned to your application or terminating the program that is occupying it.

Answer №2

An issue has arisen pointing out that the port is currently being utilized. It is advisable to modify the code and switch to a different port. On many occasions, node.js/express examples define the port in the file app.js.

Answer №3

EADDRINUSE occurs when your application is attempting to use a port that is already in use by another program. To resolve this issue, consider changing the port number to see if it resolves the problem.

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

Express Stormpath: Preserve custom data

Running an express server with express-stormpath for authentication and storing custom user data has been smooth sailing. But I'm facing a challenge when it comes to posting data to the server and saving it to stormpath. Here's how my current po ...

Error occurs when attempting to write to a Node stream after it has already

I'm experimenting with streaming to upload and download files. Here is a simple file download route that unzips my compressed file and sends it via stream: app.get('/file', (req, res) => { fs.createReadStream('./upload/compres ...

Guide on setting up a connection to Hyperledger Fabric Gateway Service (recently introduced in HF 2.4) while ensuring TLS is enabled

My Hyperledger Fabric network setup is functioning well, except when I attempt to utilize the new Fabric-Gateway SDK (). I recently upgraded my network from version 2.3.1 to 2.4.1 and wanted to experiment with the new SDK, but I am encountering connection ...

When utilizing 'fs' in Next.js, there are no error messages displayed, yet the file is not being written simultaneously. Unfortunately, I have been unable to locate any effective solutions to resolve this issue

I am currently encountering an issue while using the fs module in a Next.js/React application context. I am developing an app for renting apartments. I have a JSON file named database.json which contains some data, and I am able to retrieve and use it with ...

lotion.js is throwing an error in the program that keeps track of the total number of transactions that have taken place (TypeError: app.listen is not recognized as

let app = require('lotion')({ initialState: { count: 0 } }) app.use((state, tx) => { state.count++ }) app.listen(3000) I encountered an issue when trying to run the code above from the official lotion js website that resulted in the fol ...

Determining if a specific time falls within a certain range in JavaScript

I'm currently working on a Node.js application, but I have limited experience with Javascript. As part of my application, I need to implement validations for events and ensure that no two events can run simultaneously. To achieve this, I have set up ...

The Maven build encountered an error while trying to execute a goal, resulting in the inability to

I'm currently working on a Windows 7 computer and I've received some code that requires me to execute "mvn install" in order to build the application. However, when I try to run this command, I encounter the following error: Failed to execute ...

Testing asynchronous errors with Sequelize and Postgres

Recently, I've been working on writing unit tests for Sequelize with a Postgres database and using Jest for testing. While trying to get the following code to work: test('email field only takes valid emails', () => { expect.assertions( ...

Redirect all subdomains to corresponding folders with matching names

I am working on an Express app and I have the requirement to route each subdomain to its corresponding folder in the filesystem. To illustrate, when a GET request is made to example.com, it should look for files in the root folder ./, whereas blog.example. ...

Is it necessary for Webpack to package all dependent node modules with the final bundle in production mode?

It's common knowledge that when we run npm run build, React scripts utilize Webpack to create a bundle by examining the entire dependency graph (following imports) and generating a bundle.js which is then stored in the dist/build folder for production ...

Comparing Procedural Database Code to Using Multiple Database Calls

Here's a question that requires a bit of thought... I'm currently in the process of designing a database and I find myself unsure about where to place the procedural logic that handles complex queries. There are two options I am considering: 1) ...

Leveraging thousands of on() event listeners in Firebase demonstrates exceptional design

We are looking to perform operations on our Firebase database and modify data based on user input from their mobile devices by changing a flag. Currently, we are using the `on()` method to listen to specific flags within each user's node. This listen ...

Modifying the attribute of an element inside an array

Presented below is an object: { "_id" : ObjectId("5a8d83d5d5048f1c9ae877a8"), "websites" : [ "", "", "" ], "keys" : [ { "_id" : ObjectId("5a8d83d5d5048f1c9ae877af"), "name ...

Add more JSON entries to the data submission in Express

Purpose: My goal is to ensure that the JSON data I submit is formatted correctly when it arrives in the JSON file, regardless of the number of entries I submit. Challenge: Currently, the data I submit does not append properly in the JSON file. It appear ...

Set up Express.js using npm

Just set up nodejs on my Ubuntu 14.04 system. Upon running node --version, I see that it's v4.4.2. Also, npm is installed with version 3.9.2. When I execute the command npm install -g express, this is the output I get: install express js Once the ins ...

Tips for extracting JSON data from an API with identical names as values

I am working on a project to create a data search system using JSON. The JSON data is stored in a REST API, and the structure of the API is as follows: [ { "info": "cute but big animal", "type": "pig", ...

What is the best way to conceal content within a URL while still transmitting it to the server using node.js and express?

I have been trying to figure out how to hide certain content from the URL, but still need to send that information to the server in my Express app. So far, I haven't found any solutions that work. For example, if I have a URL like www.abc.com/viewblo ...

Serve a static file and execute a code snippet at the root URL

I am looking to serve a directory of static files containing HTML and js using the following code: app.use('/', express.static('./public')); In addition, I want to execute a specific piece of code every time a user visits the site. Her ...

Tips for adding multiple entries to a TransactionWould you like to know

I have a question regarding SQL Server transactions I need to insert data into both Table_A and Table_B. Table_B includes a key from Table_A, and the number of records in Table_B with the Table_A key can vary. [Table_A] id: , title: [Table_B] ...

The response header Set-Cookie fails to create a cookie in the browser

I'm facing an issue with setting a cookie post user login. The problem seems to occur only in production environment. Upon hitting the /login endpoint, a cookie is returned with a token and other necessary information. if (isPasswordValid === true) { ...