npm - Yarn 删除已安装依赖项中的文件夹

标签 npm leaflet yarnpkg

我正在使用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 文件夹中两个包管理器安装的文件夹的样子:

yarn yarn install

npm npm install

最佳答案

我的项目中有一个 .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/

相关文章:

yarnpkg - 无法读取未定义的属性 'pm2_env'

macos - 我正在尝试清理 OSX 10.13 中的 usr/local 文件夹

react-native - 无法解析模块 `stream`

npm - 防止 Yarn 安装在项目中运行(即强制 NPM 安装)

javascript - 添加有关突出显示状态的图例和信息

React-Native - 无法从 node_modules/eslint/lib/cli-engine/cli-engine.js 解析模块 fs

node.js - 如何从自定义镜像安装Electron

javascript - Webpack - 语法错误 : Unexpected token {

javascript - 如何从服务器加载传单层属性?

php - 如何将传单多边形框放大 5%?