且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

npm 安装本地模块的依赖项

更新时间:2022-12-08 09:44:08

我找到了一个在不久的将来对我有用的解决方案.我将 local_modulepackage.json 更改为:

I have found a solution that will work for me in the immediate future. I changed local_module's package.json to:

{
    "scripts": {
        "prepublish": "npm install --ignore-scripts && gulp release"
    },
    "devDependencies": {
        "gulp": "..."
    }
}

npm install 从主项目运行时,预发布步骤首先在 local_module 中运行,所以我强制预发布也进行安装,以便 gulp 可用做实际的预发布步骤.然而,这并不理想.

When npm install is run from the main project, the prepublish step is run first in local_module, so I force prepublish to also do an install so that gulp is available to do the actual prepublish step. This is hardly ideal however.