Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.7k views
in Technique[技术] by (71.8m points)

node.js - Nodejs hasn't installed the correct npm version

I've recently installed Nodejs and I've found that npm won't run. Anytime I attempt to install something such as mongoose I recieve the error "cb.apply is not a function". I've inistalled and cleaned the npm cache and reinstalled several times without fixing the issue. think I need a newer version of npm but I get the same errr whenever I try to upgrade npm.

I'm using Windows 10, Nodejs 15.5.1 and the npm that the nodejs installer installed is npm v5.2.0.

The full log is:

0 info it worked if it ends with ok

1 verbose cli [

1 verbose cli   'C:\Program Files\nodejs\node.exe',

1 verbose cli   'C:\Users\david\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',

1 verbose cli   'install',

1 verbose cli   '-g',

1 verbose cli   'npm@7.4.0'

1 verbose cli ]

2 info using npm@5.2.0

3 info using node@v15.5.1

4 verbose npm-session dfbeb9d9aa5b0e25

5 silly install loadCurrentTree

6 silly install readGlobalPackageData

7 http fetch GET 200 https://registry.npmjs.org/npm 958ms

8 http fetch GET 200 https://registry.npmjs.org/npm/-/npm-7.4.0.tgz 1679ms

9 silly pacote version manifest for npm@7.4.0 fetched in 2742ms

10 verbose stack TypeError: cb.apply is not a function

10 verbose stack     at C:UsersdavidAppDataRoaming
pm
ode_modules
pm
ode_modulesgraceful-fspolyfills.js:287:18

10 verbose stack     at FSReqCallback.oncomplete (node:fs:200:5)

11 verbose cwd C:Usersdavid

12 verbose Windows_NT 10.0.18363

13 verbose argv "C:\Program Files\nodejs\node.exe" 
"C:\Users\david\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "npm@7.4.0"
14 verbose node v15.5.1

15 verbose npm  v5.2.0

16 error cb.apply is not a function

17 verbose exit [ 1, true ]

Any help would be amazing


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...