>Error: ENOENT: no such file or directory, open 'C: postman code example

Example 1: mern heroku Error: ENOENT: no such file or directory

if (process.env.NODE_ENV) {
    app.use(express.static(path.resolve(process.cwd(), 'client/build')))
    app.get('*', (req, res) => {
      res.sendFile(path.resolve(process.cwd(), 'client/build/index.html'))
    })
  }

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.

Tags:

Misc Example