赞
踩
六、删除package-locak.json后,npm install 无法生成新的package-lock.json文件
原因: package.json中`"preinstall": "npx npm-force-resolutions"`强制npm安装特定的传递依赖项版本,该命令需要package-lock.json
解决方法:先注释掉//"preinstall": "npx npm-force-resolutions",然后npm install生成package-lock.json文件,最后再取消注释重新安装。
都可以通过【五】解决
通过npm view sourece-map-support查看模块的注册信息,重新安装一下就可以了
经查询发现,fsevent是mac系统的,在win或者Linux下使用了,所以会有警告,忽略即可。fsevent的作用是能够检测文件目录的修改,可以记录恶意软件的非法操作,获取恶意软件的完整路径,删除和修改日期。
提示bower不是内部或外部命令,也不是可运行的程序。
直接运行安装命令npm install bower -g
解决方案1:卸载对应插件后,重新安装报错的插件
npm uninstall webpack-dev-server
npm install webpack-dev-server@2.9.1
npm run dev
----------------------------------------------------------
npm uninstall bower-nexus3-resolver
npm install bower-nexus3-resolver解决方案2:项目全部重新安装一次,如果还是不可以的话,再清空重新安装
rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install
npm install的执行过程是这样的:
1. 发出npm install命令
2. npm 向 registry 查询模块压缩包的网址
3. 下载压缩包,存放在(本地NPM缓存路径)目录
4. 解压压缩包到当前项目的node_modules目录
也就是说一个模块安装以后,本地其实保存了两份。一份是 npm 目录下的压缩包,另一份是 node_modules 目录下解压后的代码。
但是,运行 npm install 的时候,只会检查 node_modules 目录,而不会检查 npm 目录。
如果一个模块在 npm 下有压缩包,但是没有安装在 node_modules 目录中,npm 依然会从远程仓库下载一次新的压缩包。利用已经在缓存中(之前已经备份的模块)实现离线模块安装的 cache 机制已经在V5的时候重写了,缓存将由 npm 来全局维护,不再需要开发人员操心,离线安装时将不再尝试连接网络,而是降级尝试从缓存中读取,或者直接失败。就是如果你 offline(离线) ,npm将无缝地使用您的缓存。
所以解决办法就是执行命令清除缓存,npm cache clean --force 命令就是清除这种缓存的,
============================================================================
- npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
-
- npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
-
- npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
-
- npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
-
- npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
-
- npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
-
- //翻译
- npm WARN 已弃用 core-js@2.6.12: core-js@<3.3 不再维护,由于问题数量不推荐使用。由于 V8 引擎的奇思妙想,旧的 core-js 版本中的功能检测可能会导致速度降低 100 倍,即使没有使用 polyfill。请将您的依赖项升级到 core-js 的实际版本。
-
- npm WARN 已弃用 debug@4.1.1:调试版本 >=3.2.0 <3.2.7 || >=4 <4.3.1 在 Node.js 环境中使用时具有低严重性的 ReDos 回归。建议您升级到 3.2.7 或 4.3.1。 (https://github.com/visionmedia/debug/issues/797)
-
- npm WARN 已弃用 chokidar@2.1.8:Chokidar 2 将在节点 v14+ 上中断。升级到 chokidar 3,依赖项减少 15 倍。
-
- npm WARN 已弃用 fsevents@1.2.13:fsevents 1 将在节点 v14+ 上中断,并且可能使用不安全的二进制文件。升级到 fsevents 2。
-
- npm WARN 已弃用 urix@0.1.0:请参阅 https://github.com/lydell/urix#deprecated
-
- npm WARN 已弃用 resolve-url@0.2.1:https://github.com/lydell/resolve-url#deprecated

参考文章:npm install 原理分析
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。