module已经装了但仍提示找不到的解决方法

今天遇到的问题:(这里只是个例子)


解决方法:

npm clean cache --force

删了node_modules 和 package-lock ,然后npm install

如果再不行,看看这个modulle所需要的npm啊什么鬼的版本是否符合你电脑的版本。

不符合就升级。

这里推荐一个最好的,最省心的方法:

首先打开Windows PowerShell 软件(以管理员打开),然后:执行下列所有命令去升级!

Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。

PS C:\Windows\system32> Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
PS C:\Windows\system32> npm install -g npm-windows-upgrade
F:\nodejs\npm-windows-upgrade -> F:\nodejs\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade.js
+ [email protected]
added 72 packages in 14.766s
PS C:\Windows\system32> npm-windows-upgrade
npm-windows-upgrade v6.0.1
? Which version do you want to install? 6.10.2
Checked system for npm installation:
According to PowerShell: F:\nodejs
According to npm:        F:\nodejs
Decided that npm is installed in F:\nodejs
Upgrading npm... /

Upgrading npm (fallback method)... \

You wanted to install npm 6.10.2, but the installed version is 6.9.0.

A common reason is an attempted "npm install npm" or "npm upgrade npm". As of today, the only solution is to completely uninstall and then reinstall Node.js. For a small tutorial, please see https://github.com/felixrieseberg/npm-windows-upgrade#usage.

Please consider reporting your trouble to https://aka.ms/npm-issues.

Debug Information:

http_parser: 2.8.0 | node: 8.11.0 | v8: 6.2.414.50 | uv: 1.19.1 | zlib: 1.2.11 | ares: 1.10.1-DEV | modules: 57 | nghttp2: 1.25.0 | openssl: 1.0.2o | icu: 60.1 | unicode: 10.0 | cldr: 32.0 | tz: 2017c | os: win32 x64


PS C:\Windows\system32> npm-windows-upgrade -p -v latest
npm-windows-upgrade v6.0.1
Checked system for npm installation:
According to PowerShell: C:\Users\XiaoYe\AppData\Roaming\npm
According to npm:        F:\nodejs
Decided that npm is installed in C:\Users\XiaoYe\AppData\Roaming\npm
Upgrading npm...


Upgrade finished. Your new npm version is 6.10.3. Have a nice day!
PS C:\Windows\system32>

成功升级,然后再试一下

npm clean cache --force

删了node_modules 和 package-lock ,然后npm install,然后npm run dev看看。 

猜你喜欢

转载自www.cnblogs.com/XiaoYEBLog/p/11332010.html