[英]Files are not packed when importing package.json
I'm writing a cli package and for showing the version I'm importing version
from package.json
.我正在编写一个 cli 包并显示我从
package.json
导入version
。
When I do that, after running tsc
the dist folder looks like that:当我这样做时,在运行
tsc
,dist 文件夹如下所示:
/dist
--/package.json
--/README.md
--/src
----files
----...
the package.json
has the following property: package.json
具有以下属性:
"files": [
"dist/**/*"
],
I use npm pack
to see what will be part of the tarball.我使用
npm pack
来查看 tarball 的一部分。 when I try to pack it, only 3 files are packed:当我尝试打包时,只打包了 3 个文件:
npm notice 1.9kB dist/package.json
npm notice 1.7kB package.json
npm notice 1.2kB README.md
but If I don't import the version from package.json
, it is no longer in the dist
directory and all the content in dist
gets packed properly.但如果我不从进口版本
package.json
,它不再是在dist
目录中的所有内容dist
得到妥善包装。
As a temporary measure I'm reading package.json
with fs
, but that's far an elegant solution.作为临时措施,我正在阅读带有
fs
package.json
,但这远远是一个优雅的解决方案。 Is there a way to solve this issue?有没有办法解决这个问题?
由 npm 引起的问题,降级权限(在 ci 上以 root 身份运行),添加到 npm 配置unsafe-perm
解决了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.