No return on Windows and Node v7.1.0?
See original GitHub issueThe script below comes to a complete and silent stop at line 28 specifically under node v7.1.0 in Windows. No error, no exception, no stack dump, just a silent drop out to the command line as if nothing devastatingly horrible had just been perpetrated. 😃
If I backtrack the node version to v7.0.0 or earlier, it works. Same script also works as expected on a Mac, in v7.1.0.
The console.log(res)
on line 27 does execute, but the return seems to never happen properly; line 31-32 with console.log('\n\nvoteds', voteds);
never shows an array built from map()
on line 17. Also, the catch()
and finally()
never execute.
Any suggestions?
/* jslint node:true, esversion:6 */
'use strict';
const _ = require('lodash');
const promise = require('bluebird');
const fs = promise.promisifyAll(require('fs'));
const rp = require('request-promise');
fs.readFileAsync('emails.txt', 'utf8')
.then(function(file) { // read file into an array
//console.log('file', file);
return promise.map(file.split('\r\n'), line => {
return { Agent: null, VoterID: null, Email: line, IsVerified: null };
});
})
.map(function(email) {
//console.log('email', email);
let options = {
uri: '...',
method: 'POST',
body: { email: email.Email },
json: true
};
return rp(options)
.then(function(res) {
console.log(res);
return res;
});
})
.then(function(voteds) {
console.log('\n\nvoteds', voteds);
})
.catch(function(err) {
console.error('\n\nERROR', err);
})
.finally(function() {
console.log('\n\ndone!');
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
readFile(fd) does not read the whole file (at least on Windows ...
Version: v7.1.0 Platform: Windows 10 64-bit Subsystem: fs I wrote a small test ... readFileSync returned a buffer with length 8192 PASSED.
Read more >NVM for Windows not working? - node.js - Stack Overflow
Open a CMD prompt (run as administrator), and install the downloaded version of nvm, nvm-setup.exe, from within this CMD command prompt. From within...
Read more >Known issues with Tivoli Storage Manager Operations Center ...
3.4 to Tivoli Storage Manager V7.1.0. Return to list. Alert-related problems might occur after a hub or spoke server is renamed. Symptoms. One ......
Read more >Download & Update Node.js to the Latest Version! Node v19 ...
Direct download links to update to the latest Node.js versions: Node v19.0.0 / LTS v16.18.0. ... Node.js LTS & Current Download for Windows:....
Read more >Installing a custom version of NVM and Node.js
This command does not return anything. If you see an error such as setfattr: /nvm.sh: No such file or directory, something wasn't installed...
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
I’m exploring https://github.com/nodejs/node/issues/9542 as a possible reason, with help from a Gitter user(@not-an-aardvark on petkaantonov/bluebird) given the specificity of the error wrt to the node version and environment, there must be a regression or a bug introduced.
Thanks, good to know!