Two versions of same npm package in Node application

后端 未结 5 919
无人共我
无人共我 2021-01-30 10:34

I\'m working on a CLI tool in NodeJS that uses another NodeJs package that we develop, which is an SDK.

The thing is, we just published a V2 version of that SDK, and we

5条回答
  •  隐瞒了意图╮
    2021-01-30 11:36

    I needed to run two versions of tfjs-core and found that both needed to be built after being installed.

    package.json:

    "dependencies": {
      "tfjs-core-0.14.3": "git://github.com/tensorflow/tfjs-core#bb0a830b3bda1461327f083ceb3f889117209db2",
      "tfjs-core-1.1.0": "git://github.com/tensorflow/tfjs-core#220660ed8b9a252f9d0847a4f4e3c76ba5188669"
    }
    

    Then:

    cd node_modules/tfjs-core-0.14.3 && yarn install && yarn build-npm && cd ../../
    cd node_modules/tfjs-core-1.1.0  && yarn install && yarn build-npm && cd ../../
    

    And finally, to use the libraries:

    import * as tf0143 from '../node_modules/tfjs-core-0.14.3/dist/tf-core.min.js';
    import * as tf110  from '../node_modules/tfjs-core-1.1.0/dist/tf-core.min.js';
    

提交回复
热议问题