[英]react-native: switch from yarn to npm
Is there a step-by-step process to change a react-native project from using yarn as the package manager to using npm?是否有将 react-native 项目从使用 yarn 作为包管理器更改为使用 npm 的分步过程? All I can find after several days of searching are instructions to go from npm to yarn and a package called deyarn which doesn't seem to fully work for me.
经过几天的搜索,我只能找到从 npm 到 yarn 的说明以及一个名为deyarn的包,它似乎并不完全适合我。 Does anyone have a good resource on this?
有没有人有这方面的好资源?
Try this :尝试这个 :
yarn.lock
(don't need this file).yarn.lock
(不需要这个文件)。node_modules
node_modules
package.json
, change script use yarn to the same command with npm
package.json
,将脚本 use yarn 更改为与npm
相同的命令yarn
(don't need to remove if you want to use npm
for one project)yarn
包(如果你想在一个项目中使用npm
不需要删除)yarn
if you don't want to use it again.yarn
请将其取下。npm
(if you installed, ignore this step)npm
(如果你安装了,忽略这一步)Can you upload some error
, you said that not fully work
.你能不能上传一些
error
,你not fully work
。
Edit:编辑:
If you want to change npm
to yarn
, it same:如果要将
npm
更改为yarn
,则相同:
package-lock.json
(don't need this file).package-lock.json
(不需要这个文件)。node_modules
node_modules
package.json
, change script uses npm
to the same command with yarn
package.json
,更改脚本使用npm
与yarn
相同的命令npm
(don't need to remove if you want to use yarn
for one project)npm
全局包(如果你想在一个项目中使用yarn
不需要删除)npm
if you don't want to use it again.npm
。yarn
(if you installed, ignore this step)yarn
(如果你安装了,忽略这一步)You can see CLI commands comparison for 3rd step您可以看到第三步的CLI 命令比较
You can try taking the following steps:您可以尝试采取以下步骤:
node_modules
node_modules
npm install
npm install
This should work because npm and yarn use the same package.json.这应该有效,因为 npm 和 yarn 使用相同的 package.json。
The deyarn package worked brilliantly for me. deyarn包对我来说效果很好。
Note that it will only flag (not auto-update) any package-lock.json scripts that you may need to update.请注意,它只会标记(而不是自动更新)您可能需要更新的任何 package-lock.json 脚本。
Depending on your environment needs, you may also want to strip out the engines: yarn: '..'
entry it adds to your package-lock.json.根据您的环境需要,您可能还想去掉
engines: yarn: '..'
条目,它添加到您的 package-lock.json 中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.