[英]Create pseudo node_modules folder on npm install
I updated some libraries within my project and now I get an issue with the zlib
within ng2-pdf-viewer
. 我在项目中更新了一些库,现在
ng2-pdf-viewer
的zlib
了问题。 There is also an issue created on github, that helped to fix it for now: https://github.com/VadimDez/ng2-pdf-viewer/issues/322#issuecomment-389281242 在github上还创建了一个问题,目前可以解决此问题: https : //github.com/VadimDez/ng2-pdf-viewer/issues/322#issuecomment-389281242
The solution suggests to create a zlib
folder within node_modules
and add an empty index.js
and a basic package.json
. 该解决方案建议在
node_modules
创建一个zlib
文件夹,并添加一个空的index.js
和一个基本的package.json
。
This fixed the issue. 这解决了问题。 But now I want to automate the process, since every time anyone runs
npm install
the pseudo folder is gone again. 但是现在我要自动化该过程,因为每次有人运行
npm install
,伪文件夹都会消失。
Is there any way to create this folder with it's content automatically on npm install
(maybe with mkdir
or something)? 有什么方法可以在
npm install
上自动创建带有其内容的文件夹(也许使用mkdir
或其他东西)?
PS: The solution to put "browser": { "zlib": false }
into the package.json
didn't help in my case... PS:将
"browser": { "zlib": false }
放入package.json
的解决方案对我来说没有帮助...
You should be able to create a script to create the directory, and then use a hook to run that script after you run npm install: 您应该能够创建脚本来创建目录,然后在运行npm install之后使用钩子来运行该脚本:
"scripts": {
"postinstall": "myCustomScriptToCreateFolder",
},
More reading: 更多阅读:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.