react-native:从纱线切换到 npm [英] react-native: switch from yarn to npm
本文介绍了react-native:从纱线切换到 npm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有将 react-native 项目从使用 yarn 作为包管理器更改为使用 npm 的分步过程?经过几天的搜索,我只能找到从 npm 到 yarn 的说明以及一个名为 deyarn 的包似乎并不完全适合我.有没有人有这方面的好资源?
Is there a step-by-step process to change a react-native project from using yarn as the package manager to using 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. Does anyone have a good resource on this?
推荐答案
试试这个:
- 删除
yarn.lock
(不需要这个文件). - 删除文件夹
node_modules
- 在
package.json
中,将脚本 use yarn 更改为与npm
相同的命令 - 移除
yarn
的所有全局包(如果你想在一个项目中使用npm
则不需要移除) - 如果您不想再次使用它,请将
yarn
移除. - 安装
npm
(如果你安装了,忽略这一步) - 安装您需要的全局和本地包
- Remove
yarn.lock
(don't need this file). - Remove folder
node_modules
- In
package.json
, change script use yarn to the same command withnpm
- Remove all global package of
yarn
(don't need to remove if you want to usenpm
for one project) - Remove
yarn
if you don't want to use it again. - Install
npm
(if you installed, ignore this step) - Install global and local package you need
你能不能上传一些error
,你说不能正常工作
.
Can you upload some error
, you said that not fully work
.
如果你想把npm
改成yarn
,一样:
If you want to change npm
to yarn
, it same:
- 删除
package-lock.json
(不需要这个文件). - 删除文件夹
node_modules
- 在
package.json
中,修改脚本使用npm
与yarn
相同的命令 - 删除
npm
的所有全局包(如果你想在一个项目中使用yarn
就不需要删除) - 如果您不想再次使用它,请删除
npm
. - 安装
yarn
(如果已安装,请忽略此步骤) - 安装您需要的全局和本地包
- Remove
package-lock.json
(don't need this file). - Remove folder
node_modules
- In
package.json
, change script usesnpm
to the same command withyarn
- Remove all global package of
npm
(don't need to remove if you want to useyarn
for one project) - Remove
npm
if you don't want to use it again. - Install
yarn
(if you installed, ignore this step) - Install global and local package you need
可以看到CLI命令对比第三步
这篇关于react-native:从纱线切换到 npm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文