New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: Cannot read properties of undefined (reading 'native') #1372
Comments
The So it should not be a problem with |
Seems to point at the following if statement. 106: // fs.realpath.native only available in Node v9.2+
107: if (typeof fs.realpath.native === 'function') {
108: exports.realpath.native = u(fs.realpath.native)
109: } And seems to say your Then again, it's really hard to figure out what's wrong. |
yes, fs.realpath is undefined
After importing i tried to load the app in Chrome browser
No issues with webpack.config.js. |
I have not used any file appenders, i'm getting error as soon after importing log4js to the app React - 17.0.2 This issue can be reproduced with below steps -
|
Thanks to @aellerton who came up with PR #1374 which resolved the issue. |
Are you able to share your log4js config by any chance?
Can you also do "console.log(appenderModule)" somewhere in there?
…On Tue., 7 Mar. 2023, 18:25 MUmeshKumar, ***@***.***> wrote:
Thanks for the latest version. It solved the above issue. But with the
latest version i'm facing different issue.
[image: image]
<https://user-images.githubusercontent.com/125536990/223394801-1d6e0295-c4ee-4795-b7d3-f320da7f5b30.png>
[image: image]
<https://user-images.githubusercontent.com/125536990/223395044-ff25d9ae-02fb-48d1-a2ca-9ed087a77daf.png>
Can you please help?
Thanks,
-Umesh
—
Reply to this email directly, view it on GitHub
<#1372 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHMJIS3HFSBL7ZZ6YHYAY3W24EJPANCNFSM6AAAAAAVOMUKHM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sorry for the late reply. I used below log4js config - When i checked "appenderModule" we are getting empty object. I understand from the previous PR, we cannot use any appenders in the browser. Is there any other way to log? |
I believe it is because of You should be able to use
Try it and see if it works. |
Sure. Thanks for the reply @lamweili @aellerton |
@MUmeshKumar, is your issue now resolved? Is it working now? |
Try the 'basic' layout with console, i.e.
{ type: "console", layout: { type: "basic" } }
Let us know?
…On Fri, 10 Mar 2023 at 13:26, Lam Wei Li ***@***.***> wrote:
@MUmeshKumar <https://github.com/MUmeshKumar>, is your issue now
resolved? Is it working now?
—
Reply to this email directly, view it on GitHub
<#1372 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHMJIXI5FWFIDHXO47WZMLW3K3OZANCNFSM6AAAAAAVOMUKHM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I've tried this - Logs are printing in browser console and no file has been created
Same goes with |
Yup, because a browser does not have Node.js libraries to write to a file. As for the layout type, it defaults to Nevertheless, setting it to |
@MUmeshKumar Is everything fine now? |
Yes. Thanks for clearing out the queries. @lamweili |
Hi,
When i try to import log4js in my app.js i'm getting following error -
Uncaught TypeError: Cannot read properties of undefined (reading 'native')
at ./node_modules/log4js/node_modules/fs-extra/lib/fs/index.js (index.js:107:1)
at webpack_require (bootstrap:856:1)
at fn (bootstrap:150:1)
at ./node_modules/log4js/node_modules/fs-extra/lib/index.js (index.js:6:1)
at webpack_require (bootstrap:856:1)
at fn (bootstrap:150:1)
at Object. (RollingFileWriteStream.js:2:1)
at ./node_modules/log4js/node_modules/streamroller/lib/RollingFileWriteStream.js (RollingFileWriteStream.js:338:1)
at webpack_require (bootstrap:856:1)
at fn (bootstrap:150:1)
at ./node_modules/log4js/node_modules/streamroller/lib/index.js (index.js:2:1)
at webpack_require (bootstrap:856:1)
at fn (bootstrap:150:1)
at Object. (file.js:3:1)
at ./node_modules/log4js/lib/appenders/file.js (file.js:154:1)
at webpack_require (bootstrap:856:1)
at fn (bootstrap:150:1)
at Object. (index.js:17:1)
at ./node_modules/log4js/lib/appenders/index.js (index.js:182:1)
at webpack_require (bootstrap:856:1)
at fn (bootstrap:150:1)
at ./node_modules/log4js/lib/log4js.js (log4js.js:27:1)
at webpack_require (bootstrap:856:1)
at fn (bootstrap:150:1)
at Module. (appenders sync:9:1)
at ./src/App.js (App.js:332:1)
My setup configuration -
React - 17.0.2
Node - v16.19.0
npm - 8.19.3
log4js - 6.8.0
I see version of fs-extra mentioned in the log4js/package.json is ^11.1.0 but in the log4js/node_modules/fs-extra/package.json says 8.1.0
Even after modifying the fs-extra module with the latest version 11.1.0, still error persists.
I also have seen similar error in Angular(#1225) followed the steps you mentioned. still facing same problem.
Can you please let me know what could be the possible reason for this error?
Thanks for your help in advance!
Best regards,
-Umesh
The text was updated successfully, but these errors were encountered: