admin管理员组文章数量:1291090
When I try to publish a module in npm repository it is not taking lib folder. I added it in package.json file as below but it is not taking that lib folder. Lib folder contains files that are used by module.
{
"name": "sample",
"version": "1.0.0",
"description": "",
"main": "sample.js",
"directories":{
"lib": "/lib"
}
}
When I try to publish a module in npm repository it is not taking lib folder. I added it in package.json file as below but it is not taking that lib folder. Lib folder contains files that are used by module.
{
"name": "sample",
"version": "1.0.0",
"description": "",
"main": "sample.js",
"directories":{
"lib": "/lib"
}
}
Share
Improve this question
edited Jul 10, 2019 at 8:37
Naxos84
2,0381 gold badge24 silver badges35 bronze badges
asked Sep 12, 2015 at 10:21
scionoftechscionoftech
6182 gold badges9 silver badges24 bronze badges
1
-
1
try removing the / from lib so it bees
"lib": "lib"
– Alex Commented Sep 12, 2015 at 10:38
3 Answers
Reset to default 4remove the / from lib, so your package.json bees
{
"name": "sample",
"version": "1.0.0",
"description": "",
"main": "sample.js",
"directories":{
"lib": "lib"
}
}
Add the files to package.json
{
"files": [ "lib" ]
}
For files
or directories
ensure the path or paths are specified as expected. Rather than /lib
you probably want ./lib
. Verify the files and folders you want to publish are not being ignored by a .npmignore
or .gitignore
dotfile in the lib
directory of your project. Also, if there's a separate package.json
file in lib
you'll wan to check that too.
For more information see:
https://docs.npmjs./files/package.json#files https://docs.npmjs./files/package.json#directories
本文标签: javascripthow to add directory in packagejson to publish in npmStack Overflow
版权声明:本文标题:javascript - how to add directory in package.json to publish in npm - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741511827a2382649.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论