我正在使用Yarn v0.19.1 安装一些依赖项。我完全删除了 node_modules
文件夹并重新安装了 yarn
。
我正在尝试安装依赖项 leaflet使用yarn add leaflet
。模块安装成功,但在 Cleaning Modules...
阶段除外,Yarn 会删除通常位于 leaflet/dist/images
中的 images
文件夹>。当我执行 npm install leaflet
时,此文件夹不会被删除。
在 yarn 安装期间,images
文件夹会一直存在,直到清理模块
阶段发生。
谁/什么在做这个?这是yarn
的作用吗?或者这是在leaflet
库中指定的内容?我该如何解决这个问题?
我检查了传单库中的package.json
,那里似乎没有什么异常。它运行一个 jake 文件,但即使在该文件中,也不会删除与图像相关的任何内容。
以下是我的 node_modules
文件夹中两个包管理器安装的文件夹的样子:
最佳答案
我的项目中有一个 .yarnclean
文件。这添加了一些在安装依赖项时要忽略的文件/文件夹。运行 yarn clean
添加了这个文件,直到我看到 this issue 时我才意识到。 。 Viewing the docs也提供了相同的信息。
我通过从忽略的目录集中删除images
解决了这个问题。
这是我的 .yarnclean
文件作为示例:
# test directories
__tests__
test
tests
powered-test
# asset directories
docs
doc
website
assets
# examples
example
examples
# code coverage directories
coverage
.nyc_output
# build scripts
Makefile
Gulpfile.js
Gruntfile.js
# configs
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
# misc
*.gz
*.md
关于npm - Yarn 删除已安装依赖项中的文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41966938/