1

I have a global bs-platform installation and a local one for a local project. They are in different versions. Everything was fine until today. Every time I try to run my local project, the following error is thrown:

bs-platform version mismatch Running bsb 5.0.4 (/home/jefferson/.nvm/versions/node/v12.4.0/lib/node_modules/bs-platform) vs vendored 4.0.5 (/home/jefferson/astrocoders/lion-carne-client/node_modules/bs-platform)

How can this be solved? I'm using yarn.

tk421
  • 5,775
  • 6
  • 23
  • 34
Jefferson Carvalho
  • 298
  • 1
  • 5
  • 9
  • How are you running bsb? Via a script? – fakenickels Jun 24 '19 at 13:13
  • No, I'm running it directly through `yarn` (`yarn bsb -make-world`) – Jefferson Carvalho Jun 24 '19 at 13:19
  • 3
    When you run like this yarns ends indeed picking the global one for some Reason, what I do to fix this is to add to "scripts" in my package.json a "bs:build": "yarn bsb -make-world", so running yarn bs:build instead will make yarn pick the right binary – fakenickels Jun 24 '19 at 14:50
  • 2
    I also do something similar to @fakenickels, in my case I run commands prefixed with `npx`, so `npx bsb` to make sure that the project's version of BuckleScript is the one that gets used. – Yawar Jun 24 '19 at 14:59

1 Answers1

2

You have a few options:

  1. Use the locally installed package

    a. Through a script defined in package.json, executed using yarn run or npm run

    b. Through executing the command via npx, which comes with npm: npx bsb -make-world

  2. Use the globally installed package by linking it into the project and overwriting any locally installed package of the same name, using either yarn link bs-platform or npm link bs-platform (only needed once per project). node_modules/bs-platform will then be a symlink that points to the globally installed package, hence no version mismatch when running the global bsb.

glennsl
  • 28,186
  • 12
  • 57
  • 75