[英]unable to install npm packages in created folder - ubuntu
The system I am using is Ubuntu 17. I cloned a repository from github in the bundler-app folder. 我使用的系统是Ubuntu17。我从github的bundler-app文件夹中克隆了一个存储库。 I created a folder packages in it using mkdir packages/myfolder
. 我使用mkdir packages/myfolder
在其中创建了一个文件mkdir packages/myfolder
。 Now, I go to the myfolder
folder and do yarn add react react-dom
and the install happens. 现在,我进入myfolder
文件夹,并在yarn add react react-dom
并进行安装。 Everything seems to go smoothly and yet when I go to the myfolder
folder and see what's in there... it's empty. 一切似乎都很顺利,但是当我转到myfolder
文件夹并查看其中的内容时,它是空的。
There's nothing in it. 里面什么都没有。
So, where did the yarn/npm packages go? 那么,yarn / npm包在哪里呢?
Does one of the parent folders of myfolder
contains a package.json
, if so yarn adds the package there. 如果myfolder
的父文件夹之一包含package.json
,那么yarn会在其中添加软件包。
If you need different behaviour to install under the current folder, even if a parent folder has package.json
, you will have to make sure current folder has a package.json
, which can be done via yarn init
. 如果您需要不同的行为来安装在当前文件夹下,即使父文件夹具有package.json
,您也必须确保当前文件夹具有package.json
,这可以通过yarn init
完成。
So in your case you can try 因此,您可以尝试
yarn init
then yarn add react react-dom
inside the folder and you will find the package in the folder yarn init
然后在文件夹内yarn add react react-dom
,您将在文件夹中找到卷装
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.