subzerocloud / subzero-cli

Tooling to aid development of subZero/PostgREST based backend APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migrations fail on Windows + Node 13.x

toubsen opened this issue · comments

Running subzero-migrations add on Windows 10 and nodejs 13.0 fails with an error. The source is the node module "sleep" which has not been updated / recompiled for nodejs 13.x.

Error output:

C:\dev\foo>subzero-migrations add
internal/modules/cjs/loader.js:1041
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '\\?\C:\Users\bar\AppData\Roaming\npm\node_modules\subzero-cli\node_modules\sleep\build\Release\node_sleep.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 79. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
�[90m    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1041:18)�[39m
�[90m    at Module.load (internal/modules/cjs/loader.js:822:32)�[39m
�[90m    at Function.Module._load (internal/modules/cjs/loader.js:730:14)�[39m
�[90m    at Module.require (internal/modules/cjs/loader.js:864:19)�[39m
�[90m    at require (internal/modules/cjs/helpers.js:74:18)�[39m
    at Object.<anonymous> (C:\Users\bar\AppData\Roaming\npm\node_modules\�[4msubzero-cli�[24m\node_modules\�[4msleep�[24m\index.js:1:13)
�[90m    at Module._compile (internal/modules/cjs/loader.js:971:30)�[39m
�[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)�[39m
�[90m    at Module.load (internal/modules/cjs/loader.js:822:32)�[39m
�[90m    at Function.Module._load (internal/modules/cjs/loader.js:730:14)�[39m

Versions:

C:\>node --version
v13.0.1
C:\>npm --version
6.12.0

this is probably because you already had subzero-cli installed then you upgraded your node version (probably using nvm) and the already installed global modules remained as is (see this if you used nvm https://github.com/nvm-sh/nvm#migrating-global-packages-while-installing)

or maybe you installed subzero-cli from source and used "link" and then upgraded node.

I am in a complicated setup (windows and WSL at the same time) so I also had some issues (reproduced your bug), what I suggest is this:

npm r -g subzero-cli
npm I -g -f subzero-cli

-f stands for force download of packages even if local cache is available

I was able to successfully run "migrations" in node 13 (on linux/wsl)

(please reopen if does not work)