'Error: Cannot find module 'binary-extensions'

I am trying to use reactjs on local system. I followed the official documentation of reactjs and was trying its tutorial on tic tac toe.

For local development environment I followed all the steps but when I try to run npm start I am getting below error

module.js:549
    throw err;
    ^

Error: Cannot find module 'binary-extensions'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/Documents/my- 
app/node_modules/chokidar/node_modules/is-binary-path/index.js:3:24)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

I am using Node v8.11.3 and npm v5.6.0

FYI I have installed binary-extensions using npm i binary-extensions but I am still getting same error.



Solution 1:[1]

Somehow, your project has lost track of the binary-extensions module.

The fix is simple.

In your project, delete node_modules/ and package-lock.json.

macOS / Linux:

rm -rf node_modules/
rm package-lock.json

Windows:

rmdir node_modules/
rm package-lock.json

Then,

npm install

This will resolve the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1