0

I am building a React app. I installed yargs and argsert manually by npm. For some reason, when I start the development server, I get the following error and stack trace. The two modules in question are listed clearly as argsert and yargs. I am unsure of how to proceed. Any feedback would be greatly appreciated.

webpack-dev-server --mode development

module.js:549
throw err;
^

Error: Cannot find module './lib/argsert'
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/josh/devel/react-app/frontend/node_modules/webpack-dev-server/node_modules/yargs/yargs.js:2:17)
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)

package.json

 {                                                                                                                                                                       
   "name": "react-app",
   "version": "1.0.0",
   "description": "",
   "main": "index.js",
   "scripts": {
   "start": "webpack-dev-server --mode development",
   "build": "webpack --mode production",
   "test": "echo \"Error: no test specified\" && exit 1"
  },
   "keywords": [],
   "author": "",
   "license": "ISC",
   "devDependencies": {
   "@babel/core": "^7.8.7",
   "@babel/preset-env": "^7.8.7",
   "@babel/preset-react": "^7.8.3",
   "babel-loader": "^8.0.6",
   "html-loader": "^0.5.5",
   "html-webpack-plugin": "^3.2.0",
   "webpack": "^4.42.0",
   "webpack-cli": "^3.3.11",
   "webpack-dev-server": "^3.10.3"
   },
   "dependencies": {
   "argsert": "^1.0.9",
   "babel-loader": "^8.0.6",
   "react": "^16.13.0",
   "react-dom": "^16.13.0",
   "react-router-dom": "^5.1.2",
   "weak-key": "^1.0.1",
   "yargs": "^15.3.1"
  }
}
Gowri G
  • 420
  • 4
  • 18
anon says hello
  • 133
  • 1
  • 2
  • 10

2 Answers2

0

Use npm i argsert yargs if it is not working working try to npm install if even tough it is not working. Delete argsert and yargs from package.json and install it again.

Rupesh Pathak
  • 11
  • 1
  • 5
0

I have installed node and npm from source and that seems to have fixed the issue. Thanks for the help everyone.

anon says hello
  • 133
  • 1
  • 2
  • 10
  • You should mark this answer then as the accepted answer. It might help others searching for similar issues to find resolved solutions. Also consider contributing by adding hints how to do the thing you did. – Juho Rutila Mar 24 '20 at 06:50