【问题标题】:updating node.js in windows 7 64 bit在 Windows 7 64 位中更新 node.js
【发布时间】:2022-04-01 17:28:39
【问题描述】:

如何在 Windows 7 64 位操作系统中更新 node.js?

我尝试了著名的:

npm cache clean -f
npm install -g n
n stable

但是在npm install -g n 中它失败了,给出了以下错误:

C:\Windows\system32>npm install -g n
npm http GET https://registry.npmjs.org/n
npm http 304 https://registry.npmjs.org/n
npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: n@1.2
.9
npm ERR! notsup Valid OS:    !win32
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: ia32

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "n"
npm ERR! cwd C:\Windows\system32
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code EBADPLATFORM
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Windows\system32\npm-debug.log
npm ERR! not ok code 0

请提出解决方案。我怀疑这可能是因为操作系统的 64 位版本。

感谢和问候。

【问题讨论】:

    标签: javascript node.js npm windows-7-x64


    【解决方案1】:

    您只需执行来自here 的最新node.js 版本的Windows 安装程序即可更新。

    n 在 Windows 上不起作用,因为它基本上是 giant (bash) shell script

    【讨论】:

    【解决方案2】:

    转到系统属性(运行:systempropertiesadvanced.exe), 在Advanced 选项卡中,单击Environment Variables

    还在System variables上, 单击New,添加名称:NODE_PATH 和值:C:\nodejs64\node_modules,然后单击OK。 点击New' again,添加名称:NODE_SKIP_PLATFORM_CHECKvalue: 1,然后点击OK

    点击关闭所有对话框中的OK

    重启你的机器,这样 explore 和 cmd 就会得到一组新的变量。

    【讨论】:

    【解决方案3】:

    我在我的 Windows 7 64 位 Service Pack 1 上成功安装了 Node.js 13.14.0。Download here

    【讨论】:

      【解决方案4】:

      正如上面评论中提到的@mscdex,您不能在 Windows 上使用 bash shell 脚本。

      从 Windows 更新的正确链接是 this one

      然后你应该点击右边的链接说“当前”。

      【讨论】:

        猜你喜欢
        • 2011-06-19
        • 2013-02-12
        • 2015-02-23
        • 2013-01-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-11-08
        • 1970-01-01
        相关资源
        最近更新 更多