npm 错误!cb.apply 不是 NPM Nodist 中的函数

Inz*_*san 3 node.js npm nodist npx

环境:

\n

1 - Windows 10

\n

2 - 节点主义者

\n

3 - 节点:v14.8.0

\n

4 - npm:6.9.0

\n

尝试全局安装 npx 或使用 npm 创建 React 应用程序。

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

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

\n
1. Go to C:\\Users(your username)\\AppData\\Roaming\n2. Delete the npm folder (possibly back it up) and if there is one npm cache folder.\n3. Run npm clean cache \xe2\x80\x94force ( \xe2\x80\x94 force is now required to clean cache)\n
Run Code Online (Sandbox Code Playgroud)\n

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

\n

Tro*_*ott 6

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 不是函数 (2认同)