npm 准备脚本不在节点模块中构建文件夹
npm prepare script not building folder in node modules
当 npm 从不同的项目安装时,我正在尝试使用 npm 的 prepare
脚本来 运行 构建步骤。
该脚本在 npm install
期间执行 运行 但是,它不会在节点模块内构建 dist
文件夹。
参考这篇文章了解更多详情http://jim-nielsen.com/blog/2018/installing-and-building-an-npm-package-from-github/
我也遇到了同样的问题。作为依赖项安装时,我的准备脚本没有在 node_modules 文件夹中创建构建目录。
最后我发现我的 .gitignore 是问题所在,它被设置为忽略版本控制的构建目录。当找不到 .npmignore 时,NPM 正在继承 .gitignore 文件,这里就是这种情况。
如 https://docs.npmjs.com/misc/developers 所述:
If there’s no .npmignore file, but there is a .gitignore file, then npm will ignore the stuff matched by the .gitignore file
所以我通过简单地在根目录中添加一个空的 .npmignore 解决了这个问题。
当 npm 从不同的项目安装时,我正在尝试使用 npm 的 prepare
脚本来 运行 构建步骤。
该脚本在 npm install
期间执行 运行 但是,它不会在节点模块内构建 dist
文件夹。
参考这篇文章了解更多详情http://jim-nielsen.com/blog/2018/installing-and-building-an-npm-package-from-github/
我也遇到了同样的问题。作为依赖项安装时,我的准备脚本没有在 node_modules 文件夹中创建构建目录。
最后我发现我的 .gitignore 是问题所在,它被设置为忽略版本控制的构建目录。当找不到 .npmignore 时,NPM 正在继承 .gitignore 文件,这里就是这种情况。
如 https://docs.npmjs.com/misc/developers 所述:
If there’s no .npmignore file, but there is a .gitignore file, then npm will ignore the stuff matched by the .gitignore file
所以我通过简单地在根目录中添加一个空的 .npmignore 解决了这个问题。