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.

No such native module with winstonjs/winston

See original GitHub issue

I get this error when I run the compiled application.

nexe.js:1129
    var doParallelLimit = function(limit, fn) {
                            ^

Error: No such native module ./transports/console
    at NativeModule.require (node.js:932:13)
    at s (nexe.js:1:176)
    at nexe.js:1:367
    at Object.Console (nexe.js:66028:12)
    at new exports.Container (nexe.js:65162:29)
    at Object.__dirname.259../winston/common (nexe.js:64514:19)
    at s (nexe.js:1:316)
    at nexe.js:1:367
    at Object.__dirname.175.events (nexe.js:47558:15)
    at s (nexe.js:1:316)

The file that might be triggering the error is https://github.com/winstonjs/winston/blob/0.8.3/lib/winston/transports.js#L32

I tried the following to workaround the dynamic requires:

In the file where I call nexe.compile(), I added a code before that to create a file on the same directory as transports.js. The file contains:

require('./transports/console');
require('./transports/daily-rotate-file');
require('./transports/file');
require('./transports/http');
require('./transports/memory');
require('./transports/transport');
require('./transports/webhook');

Then that file is required at my main file:

var _nexeDynamicBundle = false;

if (_nexeDynamicBundle) {
  require('winston/lib/winston/nexe-bundle');
}

And also, the generated binary file contains the required files as what I saw in output.exe/.rdata:

},{"./common":260,"fs":undefined,"path":undefined}],270:[function(require,module,exports){
/*
 * console.js: Transport for outputting to the console
 *
 * (C) 2010 Charlie Robbins
 * MIT LICENCE
 *
 */
},{"./transports/console":270,"./transports/daily-rotate-file":271,"./transports/file":272,"./transports/http":273,"./transports/memory":274,"./transports/transport":275,"./transports/webhook":276}],269:[function(require,module,exports){

Any idea why the error occurs?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pofidercommented, Jan 30, 2017

The issue disappeared for me after upgrading to the latest winston.

0reactions
syarulcommented, Aug 10, 2016

@calvin how do I use your transport.js?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No such module 'ExpoModulesCore' · Issue #32704 - GitHub
Description xcode give error No such module 'ExpoModulesCore' when I try build ios project. Version 0.66.0 Output of react-native info ...
Read more >
Could not find the following native modules after upgrading ...
This should fix your issue. rm -rf ios/Pods && rm -rf ios/build && cd ios && pod install && cd ../ rm -rf...
Read more >
Native Modules Intro
Sometimes a React Native app needs to access a native platform API that is not available by default in JavaScript, for example the...
Read more >
Putting the "Native" in React Native | Promptworks | Philadelphia
Here is a guide to writing native modules in React Native. ... but no such method existed in React Native or in any...
Read more >
create-react-native-module - npm
Tool to create a React Native library module or view module with a single ... See below for command-line usage, example with no...
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