【问题标题】:npm ERR! notsup Unsupported platform for n@2.1.8: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})npm 错误! notsup n@2.1.8 不支持的平台:想要 {"os":"!win32","arch":"any"}(当前:{"os":"win32","arch":"x64"})
【发布时间】:2018-05-06 08:38:03
【问题描述】:

我正在尝试在我的电脑中安装 angular 5。一切安装正确,但是当我使用“ng-serve”命令运行我的应用程序时,它显示以下错误。

You are running version v8.7.0 of Node.js, which is not supported by Angular CLI v6.
The official Node.js version that is supported is 8.9 and greater.

Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.

node.js 的当前版本是“8.7.0”,npm 是“6.0.0”。

经过大量搜索后,我按照以下步骤在 Windows 10 上更新我的 node.js

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

但是我没有使用这个命令,它显示以下错误

C:\WINDOWS\system32>npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.

C:\WINDOWS\system32>npm install -g n
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@2.1.8: 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\HP\AppData\Roaming\npm-cache\_logs\2018-05-06T07_36_10_847Z-debug.log

如何将 node.js 更新到最新版本才能运行我的 angular5 应用程序?

【问题讨论】:

    标签: angular5


    【解决方案1】:

    这里的问题是您的机器上已经安装了节点版本 8.7.0。您必须先将其删除。

    解决此问题的步骤。

    1.查看环境变量中nodejs的路径

    2.转到该路径并删除整个文件夹(旧节点js)

    3.在环境变量中删除该路径

    4.转到某个路径并在cmd中输入npm。你应该得到命令不识别。

    4.现在转到所需的路径并运行 npm install 命令。您的新版本的 node js 将被更新。

    希望我能帮上忙

    【讨论】:

      【解决方案2】:

      重新安装 ng-cli 并从 C:\Users***\AppData\Roaming 中删除 npm 和 npm-cache 解决了这个问题;

      更多细节可以在这里找到: https://stackoverflow.com/a/62184572/6792588

      【讨论】:

        猜你喜欢
        • 2019-09-29
        • 2023-03-13
        • 2020-02-20
        • 2021-08-31
        • 2017-06-08
        • 2022-09-23
        • 2022-11-08
        • 2018-08-23
        • 1970-01-01
        相关资源
        最近更新 更多