Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying host a ReactJS application on a virtualhost on CentOS 7 server. After cloning the project on the server, I tried to build the project. But after running "sudo npm install", i got following error:

npm ERR! Linux 3.10.0
npm ERR! argv "/usr/local/n/versions/node/16.13.1/bin/node" "/bin/npm" "install"
npm ERR! node v16.13.1
npm ERR! npm  v3.10.10

npm ERR! cb.apply is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/my-repo/npm-debug.log


"npm-debug.log" file has following:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/n/versions/node/16.13.1/bin/node',
1 verbose cli   '/bin/npm',
1 verbose cli   'install'
1 verbose cli ]
2 info using npm@3.10.10
3 info using node@v16.13.1
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 verbose stack TypeError: cb.apply is not a function
7 verbose stack     at /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:267:18
7 verbose stack     at FSReqCallback.oncomplete (node:fs:199:5)
8 verbose cwd /home/my-repo
9 error Linux 3.10.0
10 error argv "/usr/local/n/versions/node/16.13.1/bin/node" "/bin/npm" "install"
11 error node v16.13.1
12 error npm  v3.10.10
13 error cb.apply is not a function
14 error If you need help, you may report this error at:
14 error     <https://github.com/npm/npm/issues>
15 verbose exit [ 1, true ]


What I have tried:

I tried to upgrade npm version using "sudo npm install -g npm@latest" .
And i also tried to update "graceful-fs". But they always show same following error:

npm ERR! Linux 3.10.0
npm ERR! argv "/usr/local/n/versions/node/16.13.1/bin/node" "/bin/npm" "install" "-g" "npm@latest"
npm ERR! node v16.13.1
npm ERR! npm  v3.10.10

npm ERR! cb.apply is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/my-repo/npm-debug.log


"sudo npm cache verify" shows following:
npm ERR! Usage: npm cache add <tarball file>
npm ERR! npm cache add <folder>
npm ERR! npm cache add <tarball url>
npm ERR! npm cache add <git url>
npm ERR! npm cache add <name>@<version>
npm ERR! npm cache ls [<path>]
npm ERR! npm cache clean [<pkg>[@<version>]]


Can anyone tell me how to fix the problem ?
Posted
Updated 24-Feb-22 10:54am
v2

1 solution

Extraxt from here (covering other platforms like MS, Ubuntu etc) and in your case Linux -

Possible Solution

For linux users:

uninstall NPM, to do it go to /usr/local/lib/node_modules and do:
sudo rm -r n npm npx

Once uninstalled, re-instal it:
npm install

Even after doing this, in a specific project when trying to install a specific npm package, you may get the following error:
bash: /usr/local/bin/npm: No such file or directory

If so, in the terminal just run:

hash -r

Now you can retry installation of your wanted npm package.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900