简体   繁体   中英

Nodejs dependencies problem with graceful-fs

In a React Native build using the community build environment for Android builds reactnativecommunity/react-native-android:latest , there is a node compiler exception.

> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
                 Welcome to React Native!
                Learn once, write anywhere
/buildpath/node_modules/graceful-fs/polyfills.js:285
        if (cb) cb.apply(this, arguments)
                   ^
TypeError: cb.apply is not a function
    at /buildpath/app/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqCallback.oncomplete (fs.js:184:5)
> Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.

From what I can find so far, it's has been a problem which is fixed in a newer release of the grateful-fs component.

But then, in the depencies tree in package-lock.json there are many intermediate depencies with various versions specifications of the module. Possible, over the time the new version will propagate through the tree.

How do you address this sort of problem? The fix to use an older node engine suggested in the linked GitHub issue, does not work for me (same error), though I do not know how to validate the engine has been indeed applied.

I go with https://github.com/ds300/patch-package for minor patches, or if an upgrade of the package give more trouble then it solves.

HINT:
I recommend to also add an text-file into your patch-folder, where you describe which patch which issue solve. It's also a good Idea to add additional information about the package where the issue appear (means if you know, next release will fix this... and so on).

This way you can keep your patches clean and tight. You'll even will now after 3 month or after a year, whats the patch was for and if you can remove it now.

I resolve with npm update grateful-fs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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