npm ERR! notsup Unsupported platform for n@9.0.0: wanted {“os“:“!win32“,“arch“:“any“} (current: {“os

这篇具有很好参考价值的文章主要介绍了npm ERR! notsup Unsupported platform for n@9.0.0: wanted {“os“:“!win32“,“arch“:“any“} (current: {“os。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

出现场景:

执行 npm install -g n 时,本意是借助n模块去更新node版本,出现npm ERR! notsup Unsupported platform for n@9.0.0: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})

D:\testItem>npm install -g n
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@9.0.0: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    !win32
npm ERR! notsup Valid Arch:  any
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\yuming.w.DIGQUANT\AppData\Roaming\npm-cache\_logs\2022-10-13T05_54_00_122Z-debug.log

看了一位网友的解决办法是直接在后面--force

npm install -g n --force
D:\testItem>npm install -g n --force
npm WARN using --force I sure hope you know what you are doing.
C:\Users\yuming.w.DIGQUANT\AppData\Roaming\npm\n -> C:\Users\yuming.w.DIGQUANT\AppData\Roaming\npm\node_modules\n\bin\n
+ n@9.0.0
updated 1 package in 0.667s

运行成功之后,再次执行n -v 会出现'"bash"' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

说明这个模块不支持当前操作系统,所以npm install -g n不能在windows下执行。其实我的目的是使用n模块来升级nodejs。在windows下升级noedjs直接下载安装即可,可以直接前往Download | Node.js官网下载node的指定版本即可。无须n模块。

当然还看到一个网友的另外一种解决方式,就是可以使用git上的一个工具gnvm来替换这个n模块

下载地址:https://github.com/Kenshin/gnvm

这种方式我暂时还没有试过,有兴趣的小伙伴可以去试试!文章来源地址https://www.toymoban.com/news/detail-519129.html

到了这里,关于npm ERR! notsup Unsupported platform for n@9.0.0: wanted {“os“:“!win32“,“arch“:“any“} (current: {“os的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包