gpt4 book ai didi

npm - 缺少带有 YARN 或 NPM 包安装的 src 文件夹

转载 作者:行者123 更新时间:2023-12-04 09:36:09 27 4
gpt4 key购买 nike

创建一个简单的 package.json

yarn init

{
"name": "freedraw",
"version": "1.0.0",
"main": "index.js",
"license": "MIT"
}
添加leaflet-freedraw依赖:
yarn add leaflet-freedraw

{
"name": "freedraw",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"leaflet-freedraw": "^2.13.0"
}
}
安装的节点模块仅包含以下内容:
/dist
package.json
LICENSE
README.md
还应该安装源文件夹:
/src
freedraw 的开发人员说/src 文件夹也应该在那里。
我使用了很多包,除了这里,我到处都可以找到/src 文件夹。 npm 也是如此.

最佳答案

There sould also be the source folder installed


作者没有义务在 npm 上发布 src。
正如 Ivan 所指出的,作者似乎确实将他们的包配置为仅发布“dist”文件夹中的文件:(这可能是他们的错误)
摘自 package.json :
{
"files": [
"dist"
],
}
https://github.com/Wildhoney/Leaflet.FreeDraw/commit/3b82125994e9676ea018d67bf04a679934bbf5e8
用于 package.json 的 npm 文档"file"字段:

The optional files field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to .gitignore, but reversed: including a file, directory, or glob pattern (*, **/*, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to ["*"], which means it will include all files.


https://docs.npmjs.com/configuring-npm/package-json.html#files

关于npm - 缺少带有 YARN 或 NPM 包安装的 src 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62578297/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com