今天遇到的问题:(这里只是个例子)
解决方法:
npm clean cache --force
删了node_modules 和 package-lock ,然后npm install
如果再不行,看看这个modulle所需要的npm啊什么鬼的版本是否符合你电脑的版本。
不符合就升级。
这里推荐一个最好的,最省心的方法:
首先打开Windows PowerShell 软件(以管理员打开),然后:执行下列所有命令去升级!
Windows PowerShell 版权所有 (C) Microsoft Corporation。保留所有权利。 PS C:Windowssystem32> Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force PS C:Windowssystem32> npm install -g npm-windows-upgrade F: odejs pm-windows-upgrade -> F: odejs ode_modules pm-windows-upgradein pm-windows-upgrade.js + npm-windows-upgrade@6.0.1 added 72 packages in 14.766s PS C:Windowssystem32> 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: odejs According to npm: F: odejs Decided that npm is installed in F: odejs 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:Windowssystem32> npm-windows-upgrade -p -v latest npm-windows-upgrade v6.0.1 Checked system for npm installation: According to PowerShell: C:UsersXiaoYeAppDataRoaming pm According to npm: F: odejs Decided that npm is installed in C:UsersXiaoYeAppDataRoaming pm Upgrading npm... Upgrade finished. Your new npm version is 6.10.3. Have a nice day! PS C:Windowssystem32>
成功升级,然后再试一下
npm clean cache --force
删了node_modules 和 package-lock ,然后npm install,然后npm run dev看看。