简体   繁体   English

错误 cb.apply 不是 Node Express 项目中的函数 [尝试安装软件包时] --

[英]ERROR cb.apply is not a function [while trying to install packages] in Node Express project --

I am facing the following error, while trying to install npm packages to my proj.我在尝试将 npm 包安装到我的项目时遇到以下错误。 It's a Node, Express webapi project basically.它基本上是一个 Node,Express webapi 项目。 As you can see, project needs other packages like mssql cors.如您所见,项目需要其他包,如 mssql cors。

my package.json file.我的 package.json 文件。

{
  "name": "NEBAppDemo",
  "version": "1.0.0",
  "description": "blablabla",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon api.js"
  },
   "dependencies": {
    "body-parser": "~1.0.1",
    "cors": "2.8.1",
    "express": "~4.0.0",
    "mssql": "^6.2.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.4"
  },
  "keywords": [],
  "author": "PGChoudhury",
  "license": "ISC"
}

My installed node version is 16.10.0.我安装的节点版本是 16.10.0。 Installed npm version 6.1.0.安装了 npm 版本 6.1.0。

Error I get when run npm i is运行npm i时出现错误

npm WARN npm npm does not support Node.js v16.10.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.
npm ERR! cb.apply is not a function

I've encountered same error before in other project.我之前在其他项目中遇到过同样的错误。 Could not find a steady, reliable fix.找不到稳定可靠的修复方法。 What is 'cb.apply not a function' implying to.什么是“cb.apply not a function”暗示。 What it means?这是什么意思? What are dependencies?什么是依赖? Makes no sense package restore should have ran normally.毫无意义的包恢复应该正常运行。 Some answers pl.一些答案 pl。 What is needed to be done需要做什么

Apparently it's creating a log file for the error.显然它正在为错误创建一个日志文件。 This is what it says.这就是它所说的。

0 info it worked if it ends with ok
1 warn npm npm does not support Node.js v16.10.0
2 warn npm You should probably upgrade to a newer version of node as we
3 warn npm can't make any promises that npm will work with this version.
4 warn npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
5 warn npm You can find the latest version at https://nodejs.org/
6 verbose cli [
6 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
6 verbose cli   'C:\\Users\\PROTIK\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
6 verbose cli   'i',
6 verbose cli   'express',
6 verbose cli   '-save'
6 verbose cli ]
7 info using npm@6.1.0
blablabla ..
blabla..
12 verbose stack TypeError: cb.apply is not a function
12 verbose stack     at C:\Users\....\....\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
12 verbose stack     at FSReqCallback.oncomplete (node:fs:199:5)
blabla
blablalbla...
15 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\.....\\AppData\\....\\....\\node_modules\\npm\\bin\\npm-cli.js" "i" "express" "-save"
16 verbose node v16.10.0
17 verbose npm  v6.1.0
18 error cb.apply is not a function
19 verbose exit [ 1, true ]

spot something vital in there directly related?发现一些重要的东西在那里直接相关?

You need to install npm version 7.0.0 or above in order to run node v16.您需要安装 npm 7.0.0 或更高版本才能运行 node v16。 https://nodejs.org/en/download/releases/ https://nodejs.org/en/download/releases/

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM