Closed Gtanxingwen closed 5 years ago
That’s unhelpful. Can you provide a real code that does this?
You must update to 3.1.1 anyway. npm update
.
It looks like an issue that cause following issue - https://github.com/eigenmethod/mam/issues/11
Also probably facing a similar situation while trying to update an Atom package that uses chokidar
to v3.
fs.js:178 Uncaught (in promise) NodeError: Callback must be a function
at makeStatsCallback (fs.js:178:11)
at fs.lstat (fs.js:905:14)
at ReaddirpStream.fs.lstat (ELECTRON_ASAR.js:276:16)
at ReaddirpStream._statMethod (internal/util.js:280:30)
at ReaddirpStream._stat (...\node_modules\readdirp\index.js:171:19)
at ReaddirpStream._formatEntry (...\node_modules\readdirp\index.js:186:28)
at Promise.all.files.map.dirent (...\node_modules\readdirp\index.js:150:65)
at Array.map (<anonymous>)
at ReaddirpStream._exploreDirectory (...\node_modules\readdirp\index.js:150:45)
Any ideas?
> process.versions
ares: "1.14.0"
chrome: "66.0.3359.181"
electron: "3.1.10"
http_parser: "2.8.0"
modules: "64"
napi: "3"
nghttp2: "1.29.0"
node: "10.2.0"
openssl: "1.1.0h"
uv: "1.20.3"
v8: "6.6.346.32"
zlib: "1.2.11"
node: "10.2.0"
You could update your node to 12+. It worked for me.
Bigints are supported since 10.2 or so, I don't think this is a root cause of the issue.
@paulmillr I don't think it has anything to do with the Bigints
but more that promisify wrapper.
Piece of shit electron adding bricks where they ain't needed. We'll fix this.
Yep, looks like the electron wrapper around lsstat
doesn't know/care about any optional arguments.
@ashthespy can you show internal/util code which calls this ELECTRON_ASAR crap?
I am not sure where they overwrite it, but even the original-fs
tip from https://github.com/electron/electron/issues/1658 doesn't seem to know of any options.
Woah.
Meh: of course. https://github.com/electron/electron/pull/15323
If they can't backport to 3.1.x
then something beautiful like this might work?
$ diff index.js index_.js
21c21,23
< const supportsBigint = typeof BigInt === 'function';
---
> const isElectron = process.versions.hasOwnProperty('electron')
> && process.versions.electron[1] >= 4;
> const supportsBigint = !/^v8\./.test(process.version);
170,171c172,173
< if (isWindows && supportsBigint) {
< return this._statMethod(fullPath, this._statOpts);
---
> if (isWindows && supportsBigint && !isElectron) {
> return this._statMethod(fullPath,this._statOpts);
Could you check if this works on your machine?
PR opened https://github.com/paulmillr/readdirp/pull/102 PS: Sorry for the fluff, was a bit of a klutz and didnt realise github pulls reference numbers from forks as well..
readdirp-3.1.2 is out with the fix for Electron.
(node:6392) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: Callback must be a function at makeStatsCallback (fs.js:180:11) at ReaddirpStream.fs.lstat (fs.js:907:14) at ReaddirpStream._statMethod (internal/util.js:280:30) at ReaddirpStream._stat (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:171:19) at ReaddirpStream._formatEntry (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:186:28) at Promise.all.files.map.dirent (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:65) at Array.map ()
at ReaddirpStream._exploreDirectory (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:45)
(node:6392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch blo
ck, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:6392) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the No
de.js process with a non-zero exit code.
(node:6392) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeStatsCallback (fs.js:180:11)
at ReaddirpStream.fs.lstat (fs.js:907:14)
at ReaddirpStream._statMethod (internal/util.js:280:30)
at ReaddirpStream._stat (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:171:19)
at ReaddirpStream._formatEntry (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:186:28)
at Promise.all.files.map.dirent (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:65)
at Array.map ()
at ReaddirpStream._exploreDirectory (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:45)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch blo
ck, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:6392) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeStatsCallback (fs.js:180:11)
at ReaddirpStream.fs.lstat (fs.js:907:14)
at ReaddirpStream._statMethod (internal/util.js:280:30)
at ReaddirpStream._stat (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:171:19)
at ReaddirpStream._formatEntry (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:186:28)
at Promise.all.files.map.dirent (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:65)
at Array.map ()
at ReaddirpStream._exploreDirectory (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:45)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch blo
ck, or by rejecting a promise which was not handled with .catch(). (rejection id: 8)
(node:6392) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeStatsCallback (fs.js:180:11)
at ReaddirpStream.fs.lstat (fs.js:907:14)
at ReaddirpStream._statMethod (internal/util.js:280:30)
at ReaddirpStream._stat (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:171:19)
at ReaddirpStream._formatEntry (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:186:28)
at Promise.all.files.map.dirent (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:65)
at Array.map ()
at ReaddirpStream._exploreDirectory (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:45)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch blo
ck, or by rejecting a promise which was not handled with .catch(). (rejection id: 23)
(node:6392) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeStatsCallback (fs.js:180:11)
at ReaddirpStream.fs.lstat (fs.js:907:14)
at ReaddirpStream._statMethod (internal/util.js:280:30)
at ReaddirpStream._stat (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:171:19)
at ReaddirpStream._formatEntry (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:186:28)
at Promise.all.files.map.dirent (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:65)
at Array.map ()
at ReaddirpStream._exploreDirectory (D:\webstormProjects\new_nuxt\nuxt28\node_modules\readdirp\index.js:150:45)
(node:6392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch blo
ck, or by rejecting a promise which was not handled with .catch(). (rejection id: 25)