[英]why i can't run command "npm update" in my ionic project?
..... This kind of stuff happens exactly when you continuously remove package-lock.json
in order to update some packages, you never... ever... delete package-lock.json
, unless the project is very new and small, it's always the last solution because it can cause exactly what you are facing multiplied by 100
. .....这种事情发生在你不断删除
package-lock.json
以更新某些包时,你永远不会......永远......删除package-lock.json
,除非项目是非常新的并且小,它始终是最后的解决方案,因为它可能会导致您所面临的问题multiplied by 100
。 It has lock
in name because it has to be fixed, because it holds the exact versioning of your dependency tree.它具有
lock
名称,因为它必须被修复,因为它包含您的依赖关系树的确切版本。 you cannot recreate it, because in order to recreate it you have to use npm install
and it may not install dependency tree as it should!.您无法重新创建它,因为要重新创建它,您必须使用
npm install
并且它可能无法安装应有的依赖树! That is why you should use npm ci
instead of npm install
when generating node_modules
, because npm ci
fires error if there is no package-lock.json
checks package syncronization betwen package-lock.json and package.json
, removes old version of node_modules
, checks dependency version mismatches, and a lot more...这就是为什么在生成
node_modules
时应该使用npm ci
而不是npm install
的原因,因为如果没有package-lock.json
检查package-lock.json and package.json
之间的包同步, npm ci
会触发错误,删除旧版本的node_modules
,检查依赖版本不匹配,以及更多...
Now, you should execute the command with --force
or --legacy-peer-deps
as recommended, and pray that works, if it works you should have in mind that this is a temporary solution, what legacy-peer-deps
does is tell npm to ignore dependency conflict
and continue instalation.现在,您应该按照建议使用
--force
或--legacy-peer-deps
执行命令,并祈祷它有效,如果有效,您应该记住这是一个临时解决方案, legacy-peer-deps
所做的是告诉 npm ignore dependency conflict
并继续安装。 This can also happen, because of some deprecated package
, you should check the docs for the package in question.这也可能发生,因为某些
deprecated package
,您应该检查相关软件包的文档。 If it doesn't work, try downgrading node.js
to 15, but this would also be temporary solution.如果它不起作用,请尝试将
node.js
降级到 15,但这也是临时解决方案。 The proper solution is to manually fix the dependency conflict正确的解决方案是手动修复依赖冲突
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.