Updating bs-platform


#1

I have an existing project, and I have changed package.json from

  "devDependencies": {
    "bs-platform": "^3.1.4"

to

  "devDependencies": {
    "bs-platform": "^6.0.0"

I then deleted node_modules/bs-platform (it was a dead symlink), and tried bsb -make-world, only to get this message:

bs-platform version mismatch Running bsb 6.0.0 (/home/david/.nvm/versions/node/v11.7.0/lib/node_modules/bs-platform) vs vendored 4.0.18 (/home/david/node_modules/bs-platform)

An attempt to do an npm update --save bs-platform@6.0.0 in the /home/david/node_modules directory does nothing.

Adding a symlink to the version in .nvm/versions/node/v11.7.0/lib/node_modules fixes the problem, but this seems a terribly unsatisfying solutoin.

Clearly, I have a total mess here. What is the correct way to clean it up?


#2

I think by default, your project’s package.json would have been generated with a scripts block like:

"scripts": {
    "build": "bsb -make-world",
    "start": "bsb -make-world -w",
    "clean": "bsb -clean-world",
  },

I never run bsb and related tools directly, but always by using npm run bsb, yarn run bsb (if you use yarn) or one of the predefined scripts eg. npm run build. This way the shell’s PATH variable is set correctly, and that you are using bsb installed for your project, and not the global install (which could be a different version).


#3

For a successful upgrade, I suggest the following steps:

  1. Before upgrading, clean out your build artifacts: npx bsb -clean-world
  2. Upgrade to the new version (edit package.json then npm install)
  3. After upgrading, run npx bsb -make-world

npx is a CLI tool, part of the node/npm system, that executes the given command from the project’s node_modules folder. So there can be no confusion about which version of bsb is being run.

If you’re careful to always keep your global version of bs-platform in sync with the version in a given project, you can skip the npx and just run bsb directly.