为什么';npm是否安装并构建依赖项?

为什么';npm是否安装并构建依赖项?,npm,Npm,我将一个npm模块git分叉到我的repo中,并将其列为项目中的依赖项 "dependencies": { ... "mobx": "git+https://github.com/myaccount/mobx" } 当我运行npm install时,此模块将下载到node\u modules目录中,但它不会生成。因此,我必须转到这个目录并手动运行npm install。我是否有办法将其配置为在我的项目根目录上使用npm install构建dependnecy forked repo

我将一个npm模块git分叉到我的repo中,并将其列为项目中的依赖项

"dependencies": {
   ...
   "mobx": "git+https://github.com/myaccount/mobx"
}
当我运行
npm install
时,此模块将下载到
node\u modules
目录中,但它不会生成。因此,我必须转到这个目录并手动运行
npm install
。我是否有办法将其配置为在我的项目根目录上使用
npm install
构建dependnecy

forked repo的package.json中的
脚本如下所示:

"main": "dist/index.js",
"scripts": {
    "build": "babel src --out-dir dist",
    "prepare": "npm run build",
    "prepublish": "npm run build",
    "prebuild": "npm run build",
    "preinstall": "npm run build"
  },

正如您所看到的,
dist
目录未生成,因此此模块中没有
dist/index.js
文件。

好的,只需将
npm
升级到
5.6.0
即可解决此问题