question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not using in React Native, even only log to console.

See original GitHub issue

May be React Native disabled ‘fs’ module, but I just log to console, no need for ‘fs’.

code:

/**
 * Zai Qiu Chang App
 * https://www.zaiqiuchang.com/
 */

import winston from 'winston';

import {debug} from './config';

export default new winston.Logger({
  level: debug ? 'debug' : 'info',
  transports: [
    new winston.transports.Console()
  ]
});
import logger from './logger';
logger.debug("app");

error: image

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

4reactions
pbrunacommented, Oct 3, 2016

Hi @jaggerwang you can use rn-nodeify to hack the modules that are not present on React Native.

For example in you package.json:

"scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "postinstall": "node_modules/.bin/rn-nodeify --install fs,path --hack"
  },
0reactions
YajanaRaocommented, Aug 14, 2021

I am getting following error when I try using winston in react native project

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to do logging in React Native - Stack Overflow
Select 'Debug JS' from your app on the device, and 'Toggle debug console(shift-command-y)' from your view menu on VS Code. You need github.com/ ......
Read more >
Reviewing React Native console logs: Best practices
When anything goes wrong in an app, console.log() is the only statement we use to try and figure out what's wrong in our...
Read more >
react-native-logs - npm
Performance-aware simple logger for React-Native with namespaces, custom levels and custom transports (colored console, file writing, etc.).
Read more >
How To Use console.log() in React JS - Upmostly
Take the following React code: function Element() { //Code is OK const ...
Read more >
Invalid Hook Call Warning - React
You might be using a version of react-dom (< 16.8.0) or react-native (< 0.59) that doesn't yet support Hooks. You can run npm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found