npm:如何运行安装后?

问题描述 投票:0回答:1

在我的node.js项目中,我如何只运行

postinstall
脚本,而不运行安装?

仅供参考,这是我的 package.json :

{
  "name": "gestionclientjs",
  ...,
  "dependencies": {
  ...
  },
  "repository": {},
  "devDependencies": {
  ...
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "test": "grunt test",
    "postinstall" : "bower install && node ./app/server/dbSeed.js",
    "start": "node app/server/app.js"
  }
}

现在,我跑步:

npm install

在我的项目中,但我想运行

npm postinstall

当我想要时(并且当我确定依赖项没问题时)。

node.js npm package.json
1个回答
108
投票

您可以使用

npm run SCRIPTNAME
:

运行单独的脚本条目
$ npm run postinstall
© www.soinside.com 2019 - 2024. All rights reserved.