Uncaught Error: ENOENT: no such file or directory code example

Example 1: /usr/bin/env: ‘node’: No such file or directory

sudo add-apt-repository https://launchpad.net/~chris-lea/+archive/node.js/

sudo apt-get install -y nodejs

Example 2: ENOENT, no such file or directory

Have you created a package.json file? Maybe run this command first again.

C:\Users\Nuwanst\Documents\NodeJS\3.chat>npm init

It creates a package.json file in your folder.

Then run,

C:\Users\Nuwanst\Documents\NodeJS\3.chat>npm install socket.io --save

The --save ensures your module is saved as a dependency in your package.json file.