No such native module with winstonjs/winston
See original GitHub issueI 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:
- Created 8 years ago
- Comments:15 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The issue disappeared for me after upgrading to the latest winston.
@calvin how do I use your transport.js?