简体   繁体   English

使用npm install时删除了React-native

[英]React-native removed when use npm install

I don't understand why my npm make that and i'm new with react-native. 我不明白为什么我的npm会这样做,而且我是反应原生的新手。

Here is the description of my "bug" on Windows 10 : 这是我在Windows 10上的“bug”的描述:

I can use react-native command for run android or create react-native app like that react-native init TestApp 我可以使用react-native命令运行android或创建react-native app,就像react-native init TestApp

When i go into my app folder with cd TestApp and i run react-native link or other react-native command everythings work fine. 当我使用cd TestApp进入我的app文件夹时,我运行react-native link或其他react-native命令,Everythings工作正常。

But if i install a new package like fbsdk with npm like that npm install react-native-fbsdk --save i saw after installation this message : 但是,如果我像npm一样安装一个像fbsdk这样的新软件包npm install react-native-fbsdk --save我在安装后看到这条消息:

added 1 package and removed 639 packages in 22.207s 在22.207s中添加了1个包并删除了639个包

And after that, if i would like use react-native command i have this message : 在那之后,如果我想使用react-native命令,我有这样的消息:

Command link unrecognized. 命令link无法识别。 Make sure that you have run npm install and that you are inside a react-native project. 确保您已经运行了npm install并且您在一个react-native项目中。

For this message, i have entered react-native link command. 对于此消息,我已输入react-native link命令。

You know why npm remove all my packages ? 你知道为什么npm删除我的所有包裹?

I got the same problem. 我遇到了同样的问题。

However I solved the problem by deleting the package-lock.json and then running npm install . 但是我通过删除package-lock.json然后运行npm install解决了这个问题。

Check the answer here . 这里查看答案。

I also noticed recently that npm install doesn't do what I expect, but that may be because I'm newbie. 我最近也注意到npm install没有达到我的预期,但那可能是因为我是新手。

However yarn install is a good replacement and is working fine for me. 然而, yarn install是一个很好的替代品,对我来说工作正常。 I used it to upgrade/downgrade things by directly editing packages.json, and it also solved the npm link problem that I faced. 我用它来直接编辑packages.json来升级/降级,它也解决了我遇到的npm link问题。

Edit: downgrading to npm 7 solved all my issues 编辑:降级到npm 7解决了我的所有问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM