Cb.apply is not a function

Issue Summary

During the creation of a “headless” site I receive the error “cb.apply is not a function”. Note: I am seeing posts on the internet saying that Node 14+ should be associated with NPM 7+ not 5.

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular? All “headless” sites during install.

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser? Yes. So long as I don’t make it a “headless” site.

Replication

Create a new site
Name the site and click continue
Choose “custom” for the environment
Set PHP v7.4.1, web server nginx v1.16.0, and DB MySQL v5.7.28
Check the “Enable Atlas Add-on on this site” box
Click “Continue”
Set your username/password and click “add site”
Screenshots of the error(s):


System Details

  • Which version of Local is being used? 5.10.5+5403

  • What Operating System (OS) and OS version is being used? Windows 10 Pro

  • Local log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli ‘C:\Users\jhixon\AppData\Local\Programs\Local\Local.exe’,
1 verbose cli ‘C:\Users\jhixon\AppData\Roaming\Local\addons\@getflywheel-local-addon-headless\node_modules\npx\node_modules\npm\bin\npm-cli.js’,
1 verbose cli ‘install’,
1 verbose cli ‘create-next-app@latest’,
1 verbose cli ‘–global’,
1 verbose cli ‘–prefix’,
1 verbose cli ‘C:\Users\jhixon\npm-cache\_npx\5188’,
1 verbose cli ‘–loglevel’,
1 verbose cli ‘error’,
1 verbose cli ‘–json’
1 verbose cli ]
2 info using npm@5.1.0
3 info using node@v14.16.0
4 verbose npm-session a89a0cbffab900f3
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/create-next-app 431ms (from cache)
8 silly pacote tag manifest for create-next-app@latest fetched in 485ms
9 verbose stack TypeError: cb.apply is not a function
9 verbose stack at C:\Users\jhixon\AppData\Roaming\Local\addons@getflywheel-local-addon-headless\node_modules\npx\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
9 verbose stack at FSReqCallback.oncomplete (fs.js:184:5)
10 verbose cwd C:\Users\jhixon\Local Sites\fw-testing
11 verbose Windows_NT 10.0.19042
12 verbose argv “C:\Users\jhixon\AppData\Local\Programs\Local\Local.exe” “C:\Users\jhixon\AppData\Roaming\Local\addons\@getflywheel-local-addon-headless\node_modules\npx\node_modules\npm\bin\npm-cli.js” “install” “create-next-app@latest” “–global” “–prefix” “C:\Users\jhixon\npm-cache\_npx\5188” “–loglevel” “error” “–json”
13 verbose node v14.16.0
14 verbose npm v5.1.0
15 error cb.apply is not a function
16 verbose exit [ 1, true ]

I’m receiving the same error as described by jhixon above; however, I’m running Local on Ubuntu 20.04.2 LTS. Also looking for a solution. Very interested in trying out these tools. I found a post on Stack Overflow that said it might be related to graceful-fs. I did a global install with npm i -g graceful-fs but that did not resolve the problem. I also tried updating to the latest version of npm and node with nvm install --lts and npm install -g npm.

npm --version : 6.14.13
node --version : v14.17.3

Here’s my npm error log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/opt/Local/local',
1 verbose cli   '/home/dan/.config/Local/addons/@getflywheel-local-addon-headless/node_modules/npx/node_modules/npm/bin/npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'create-next-app@latest',
1 verbose cli   '--global',
1 verbose cli   '--prefix',
1 verbose cli   '/home/dan/.npm/_npx/383605',
1 verbose cli   '--loglevel',
1 verbose cli   'error',
1 verbose cli   '--json'
1 verbose cli ]
2 info using npm@5.1.0
3 info using node@v14.16.0
4 verbose npm-session 2b1a67ad526f0ea6
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/create-next-app 226ms (from cache)
8 silly pacote tag manifest for create-next-app@latest fetched in 315ms
9 verbose stack TypeError: cb.apply is not a function
9 verbose stack     at /home/dan/.config/Local/addons/@getflywheel-local-addon-headless/node_modules/npx/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
9 verbose stack     at FSReqCallback.oncomplete (fs.js:184:5)
10 verbose cwd /home/dan/Local Sites/loosed
11 verbose Linux 5.4.0-80-generic
12 verbose argv "/opt/Local/local" "/home/dan/.config/Local/addons/@getflywheel-local-addon-headless/node_modules/npx/node_modules/npm/bin/npm-cli.js" "install" "create-next-app@latest" "--global" "--prefix" "/home/dan/.npm/_npx/383605" "--loglevel" "error" "--json"
13 verbose node v14.16.0
14 verbose npm  v5.1.0
15 error cb.apply is not a function
16 verbose exit [ 1, true ]

Also tried with:
node v10.21.0
npm v6.14.4

Removed npx and updated to v10.2.2 of npx, tried that again with node 10 and then node 14.
Still nada, same deal.
It does look like the issue is with graceful-fs in the error log; but I don’t know how to edit the version requirements on Local’s npx install script…

I’ve tried with different versions of PHP, but always using Nginx as the HTTP server and MySQL 8 for the database… Not sure if that’d make a difference. Just trying to add any additional info that might help get this resolved or come up with some answers. @jhixon Did you ever find a solution?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.