npm run devstart error: Error: Unable to find module ‘semver’

PS C:\Users\wangting\Desktop\Wisdom_admin\wisdom_admin> npm run dev

> [email protected] dev C:\Users\wangting\Desktop\Wisdom_admin\wisdom_admin
> vue-cli-service serve

internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module 'semver'
Require stack:
- C:\Users\wangting\Desktop\Wisdom_admin\wisdom_admin\node_modules\_@[email protected]@@vue\cli-service\bin\vue-cli-service.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\wangting\Desktop\Wisdom_admin\wisdom_admin\node_modules\_@[email protected]@@vue\cli-service\bin\vue-cli-service.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\wangting\\Desktop\\Wisdom_admin\\wisdom_admin\\node_modules\\_@[email protected]@@vue\\cli-service\\bin\\vue-cli-service.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1        
npm ERR! [email protected] dev: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\wangting\AppData\Roaming\npm-cache\_logs\2021-08-06T06_20_38_961Z-debug.log
PS C:\Users\wangting\Desktop\Wisdom_admin\wisdom_admin> 

In case of such an error
you need to

Delete node_ modules

Then open the vscode editor, open the terminal, enter the project directory, and install the dependencies

cnpm install

After dependency installation is complete

Just start it again

Restart

npm run dev

You’ll find it working normally


Read More: