Search code examples
npmwindows-subsystem-for-linuxnvm

Unsupported Platform error when running npm install


I am trying to run npm in a windows wsl/ubuntu environment. I tried to run npm install on a project I just cloned down from github and got this error back

npm ERR! notsup Unsupported platform for @next/[email protected]: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})

Oddly, running npm -v gives 6.14.14 While which npm gives /home/steve/.nvm/versions/node/v14.17.4/bin/npm

Feels kind of like it's looking at two different versions? It probably shouldn't be trying to run a win32 package at all. Not sure how to remedy it though.


Solution

  • The library you're trying to install is declared as Windows-only as per the error message, but you're trying to install it on Linux (WSL count as Linux even though it's a "virtual" kernel). You should run it natively on Windows for it to succeed.

    As for the versions, npm -v reports the npm version (6.14.14) while the version in the folder name of the path refers to the node version (14.17.4). Both are different normally, even though Npm always comes bundles with Node.