1-npm - n
常见报错
windows安装n报错
D:\downloads\demo3>npm install -g n
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@9.0.0: wanted {"os":"!win32"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS: !win32
npm ERR! notsup Valid Arch: undefined
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\zhangkai\AppData\Local\npm-cache\_logs\2022-09-19T12_27_45_738Z-debug-0.log
原因:该npm模块在windows下不能安装,在Linux、Mac下可以。
解决办法:
D:\downloads\demo3>npm install -g n --force
npm WARN using --force Recommended protections disabled.
added 1 package in 642ms
加上-force就可以了,force是强制的意思,强制安装就可以了。可以达到目的。
参考:https://www.csdn.net/tags/NtDaUg2sMTc1OC1ibG9n.html