【问题标题】:npm ERR! cb.apply is not a function in NPM Nodistnpm 错误! cb.apply 不是 NPM Nodist 中的函数
【发布时间】:2020-10-26 15:42:15
【问题描述】:

环境:

1 - Windows 10

2 - 节点

3 - 节点:v14.8.0

4 - npm:6.9.0

尝试全局安装 npx 或使用 npm 创建 react 应用。

npm install -g npx
npm WARN npm npm does not support Node.js v14.8.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function

npm init react-app my-app
npm WARN npm npm does not support Node.js v14.8.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function

我已经多次尝试以下解决方案,即使 Windows 重新启动也没有用。

1. Go to C:\Users(your username)\AppData\Roaming
2. Delete the npm folder (possibly back it up) and if there is one npm cache folder.
3. Run npm clean cache —force ( — force is now required to clean cache)

我想补充的另一件事是我没有运行管理员用户。所以重新安装并不容易。

【问题讨论】:

    标签: node.js npm npx nodist


    【解决方案1】:

    npm WARN npm Node.js 支持的版本是 6、8、9、10、11、12 的最新版本。

    这意味着您正在运行旧版本的 npm,这不是您的 Node.js 二进制文件随附的版本。

    出现这种情况的原因有很多。一种可能是在您的计算机上有多个 Node.js 实例时,PATH 值不正确。

    阻力最小的路径可能是首先升级npm,在此过程中可能会升级npx。为此:

    npm install -g npm

    【讨论】:

    • npm install -g npm 返回相同的错误。 npm 错误! cb.apply 不是函数
    • 您可以使用where 来识别您的npm.exenode.exe 文件的位置吗?
    • 另外,了解%PATH% 在您的环境中的值会很有用。
    猜你喜欢
    • 2020-12-05
    • 2022-07-02
    • 1970-01-01
    • 2018-11-08
    • 2021-06-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多