【问题标题】:Run script only if specific version of node is detected仅在检测到特定版本的节点时运行脚本
【发布时间】:2018-09-03 22:49:08
【问题描述】:

我有一个非常 hack-ish 的脚本来处理仅存在于节点 v6 中的问题。

我的 package.json 中有以下内容:

"scripts": {
    "pretest": "npm run target-2016 && tsc",

我只想在节点 v6(硼)上运行 target-2016,可以吗?

【问题讨论】:

    标签: node.js nodes node-modules


    【解决方案1】:

    您可以对npm -v 的输出做一些事情。我不确定我是否会尝试将其全部放在package.json 中,所以也许这样的外部脚本会很好。

    【讨论】:

      猜你喜欢
      • 2019-09-22
      • 1970-01-01
      • 2017-07-05
      • 2014-04-06
      • 1970-01-01
      • 2020-02-04
      • 2022-01-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多