Search code examples
node.jsnpmn

I want to install the "n" package and I get an error


After I clean the cache running

npm clean cache --force

I get this warning:

npm WARN using --force Recommended protections disabled.

When I check if the cache is cleaned by running

npm cache verify

I get this error:

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"!win32"} (current: {"os":"win32"})
npm ERR! notsup Valid os: !win32
npm ERR! notsup Actual os: win32

npm ERR! A complete log of this run can be found in: C:\Users\SuperElecrtro\AppData\Local\npm-cache_logs\2024-11-05T14_34_47_325Z-debug-0.log

I found n is written as a bash script. On plain Windows there is no bash shell, so n can not run. What we do is specify in our npm package.json that we do not support Windows, and the error and error message are handled by npm itself. We don't have any control over the message.


Solution

  • You're trying to install the npm package n? From its docs:

    n is supported on macOS, Linux, including with Windows Subsystem for Linux [...]

    n does not work in native shells on Microsoft Windows

    That package just won't work on normal Windows. You need to install WSL.