简体   繁体   中英

How to fix npm command in windows 10. (MODULE NOT FOUND) (Semver)

Yesterday my npm -version is 6.14 and upgraded to 7.7.6

and now I can`t used my npm,..

can anyone help me how to fix this?

I ve also reinstall the nodejs in the latest version (from 14 to 16),. and still doesn ve also reinstall the nodejs in the latest version (from 14 to 16),. and still doesn t work

C:\laragon\www
λ npm
node:internal/modules/cjs/loader:352
      throw err;
      ^

Error: Cannot find module 'C:\Users\AbingPj\AppData\Roaming\npm\node_modules\npm\node_modules\semver\index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:344:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:557:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:910:27)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (C:\Users\AbingPj\AppData\Roaming\npm\node_modules\npm\lib\utils\unsupported.js:2:14)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32) {
  code: 'MODULE_NOT_FOUND',
  path: 'C:\\Users\\AbingPj\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\semver\\package.json',
  requestPath: 'semver'
}

C:\laragon\www
λ

Is this similar to this issue Fixing npm path in Windows 8 and 10 ?

You need to Add C:\\Program Files\\nodejs to your PATH environment variable. To do this follow these steps:

  1. Use the global Search Charm to search "Environment Variables"
  2. Click "Edit system environment variables"
  3. Click "Environment Variables" in the dialog.
  4. In the "System Variables" box, search for Path and edit it to include C:\\Program Files\\nodejs . Make sure it is separated from any other paths by a ; .

You will have to restart any currently-opened command prompts before it will take effect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM