I am running a node.js app and for some reason the node app is failing when requiring the bluebird module require('bluebird').
node version: 0.10.40
bluebird version: 3.3.4
This is really strange and the only thing I have to go off of is the stack trace here:
TypeError: Cannot call method 'split' of undefined
at Object.setBounds (app/node_modules/bluebird/js/release/debuggability.js:614:48)
at module.exports (app/node_modules/bluebird/js/release/promise.js:762:11)
at Object.<anonymous> (app/node_modules/bluebird/js/release/bluebird.js:9:36)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
var firstStackLines = firstLineError.stack.split("\n");
Again, the app runs just fine. When I add this one line require('bluebird') it crashes and I get this stack trace. Any ideas on what this error is coming from?
[Edit]
at line node_modules/bluebird/js/release/debuggability.js:614:48
> console.log(firstLineError);
[Error]
> console.log(firstLineError.message);
> console.log(firstLineError.stack);
undefined
> console.log(firstLineError.toString());
Error: Error
> console.log(firstLineError instanceof Error);
True
It is an Error object that is essentially empty
temporary solution
When I change the line node_modules/bluebird/js/release/debuggability.js:614 to
var firstStackLines = (firstLineError.stack) ? firstLineError.stack.split("\n") : "";
and line 615 to
var lastStackLines = (lastLineError.stack) ? lastLineError.stack.split("\n") : "";
it works just fine. Not sure if this has lasting effects though
I had the similar failures, more specifically:
.../node_modules/bluebird/js/release/debuggability.js:673
var firstStackLines = firstLineError.stack.split("\n");
when using node 6.2.2 with bluebird^3.4.1.
Upgrading to bluebird^3.4.6 with node v6.2.2 helped fix the error.
Manually remove your node_modules folder and re-run npm install as it sounds like NPM didn't correctly install something.
You're using the latest version of Bluebird with an outdated version of node.
The problem for me was that I was using another module pretty-error that was modifying the console object and therefore, bluebirds error handling was receiving a mutated console object that was not the shape that bluebird expected.
Related
just started with the new Vue3 initialization (npm init vue#latest) and right out of the gate i get an error:
npx: installed 1 in 1.787s
C:\neard\tmp\npm-cache\_npx\10696\node_modules\create-vue\outfile.cjs:3896
const isFeatureFlagsUsed = typeof (argv.default ?? argv.ts ?? argv.jsx ?? argv.router ?? argv.pinia ?? argv.tests ?? argv.vitest ?? argv.cypress ?? argv.playwright ?? argv.eslint) === "boolean";
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:1063:16)
at Module._compile (internal/modules/cjs/loader.js:1111:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
have no idea where to begin troubleshooting this. brand new NodeJS install. you'll see from the path that i'm running neard as my stack BUT i do not have NodeJS running on it; i have it installed in the base machine. in fact i'm not running neard at all right now, it's just where i have all my projects.
anyway. any suggestions would be helpful. i've tried searching for a similar problem, but found nothing.
From what you have provided it looks like there may be an issue with the version of Node.js you are using. The code you posted includes syntax that uses the "nullish coalescing operator" (??), which was introduced in Node.js 14.
Do
node -v
As this shouldn't be happening on the new build of node.js
So I recommend that you update to the latest node.js build: 19.2.0 as this should fix the current problem you are having.
This has recently started poping up in commandline....anyone know whats going on, Im unsure why the new package in node_modules is not compatable with node v14.16. I tried using older version of node (docs state min version for adonis 5 is version 12), although this produces a syntax error.
This container.with() is deprecated warning shows whenever using the node ace commands. How can I fix these?
Node version 14.16.0:
node --trace-warnings ace migration:rollback
(node:24088) container.with() is deprecated. Use container.withBindings() instead: DeprecationWarning
at Ioc.with (C:\project\node_modules\#adonisjs\fold\build\src\Ioc\index.js:421:17)
at DatabaseServiceProvider.registerHealthChecker (C:\project\node_modules\#adonisjs\lucid\build\providers\DatabaseProvider.js:93:32)
at DatabaseServiceProvider.boot (C:\project\node_modules\#adonisjs\lucid\build\providers\DatabaseProvider.js:140:14)
at Registrar.boot (C:\project\node_modules\#adonisjs\fold\build\src\Registrar\index.js:116:32)
at C:\project\node_modules\#adonisjs\application\build\src\Application.js:543:13
at Profiler.profileAsync (C:\project\node_modules\#adonisjs\application\node_modules\#adonisjs\profiler\build\src\Profiler\AbstractProfiler.js:20:32)
at Application.bootProviders (C:\project\node_modules\#adonisjs\application\build\src\Application.js:541:9)
at App.wire (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:192:9)
at App.onFind (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:145:13)
at Hooks.execute (C:\project\node_modules\#adonisjs\ace\build\src\Hooks\index.js:44:13)
(node:24088) container.with() is deprecated. Use container.withBindings() instead: DeprecationWarning
at Ioc.with (C:\project\node_modules\#adonisjs\fold\build\src\Ioc\index.js:421:17)
at DatabaseServiceProvider.defineValidationRules (C:\project\node_modules\#adonisjs\lucid\build\providers\DatabaseProvider.js:109:32)
at DatabaseServiceProvider.boot (C:\project\node_modules\#adonisjs\lucid\build\providers\DatabaseProvider.js:141:14)
at Registrar.boot (C:\project\node_modules\#adonisjs\fold\build\src\Registrar\index.js:116:32)
at C:\project\node_modules\#adonisjs\application\build\src\Application.js:543:13
at Profiler.profileAsync (C:\project\node_modules\#adonisjs\application\node_modules\#adonisjs\profiler\build\src\Profiler\AbstractProfiler.js:20:32)
at Application.bootProviders (C:\project\node_modules\#adonisjs\application\build\src\Application.js:541:9)
at App.wire (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:192:9)
at App.onFind (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:145:13)
at Hooks.execute (C:\project\node_modules\#adonisjs\ace\build\src\Hooks\index.js:44:13)
(node:24088) container.with() is deprecated. Use container.withBindings() instead: DeprecationWarning
at Ioc.with (C:\project\node_modules\#adonisjs\fold\build\src\Ioc\index.js:421:17)
at AuthProvider.boot (C:\project\node_modules\#adonisjs\auth\build\providers\AuthProvider.js:32:40)
at Registrar.boot (C:\project\node_modules\#adonisjs\fold\build\src\Registrar\index.js:116:32)
at C:\project\node_modules\#adonisjs\application\build\src\Application.js:543:13
at Profiler.profileAsync (C:\project\node_modules\#adonisjs\application\node_modules\#adonisjs\profiler\build\src\Profiler\AbstractProfiler.js:20:32)
at Application.bootProviders (C:\project\node_modules\#adonisjs\application\build\src\Application.js:541:9)
at App.wire (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:192:9)
at App.onFind (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:145:13)
at Hooks.execute (C:\project\node_modules\#adonisjs\ace\build\src\Hooks\index.js:44:13)
at Kernel.find (C:\project\node_modules\#adonisjs\ace\build\src\Kernel\index.js:371:13)
(node:24088) container.with() is deprecated. Use container.withBindings() instead: DeprecationWarning
at Ioc.with (C:\project\node_modules\#adonisjs\fold\build\src\Ioc\index.js:421:17)
at AuthProvider.boot (C:\project\node_modules\#adonisjs\auth\build\providers\AuthProvider.js:37:40)
at Registrar.boot (C:\project\node_modules\#adonisjs\fold\build\src\Registrar\index.js:116:32)
at C:\project\node_modules\#adonisjs\application\build\src\Application.js:543:13
at Profiler.profileAsync (C:\project\node_modules\#adonisjs\application\node_modules\#adonisjs\profiler\build\src\Profiler\AbstractProfiler.js:20:32)
at Application.bootProviders (C:\project\node_modules\#adonisjs\application\build\src\Application.js:541:9)
at App.wire (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:192:9)
at App.onFind (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:145:13)
at Hooks.execute (C:\project\node_modules\#adonisjs\ace\build\src\Hooks\index.js:44:13)
at Kernel.find (C:\project\node_modules\#adonisjs\ace\build\src\Kernel\index.js:371:13)
Node version 12.5.0:
node ace migration:rollback
C:\project\node_modules\#poppinss\utils\build\src\Helpers\string.js:241
return `${values[0]}${options?.pairSeparator || ' and '}${values[1]}`;
^
SyntaxError: Unexpected token .
at Module._compile (internal/modules/cjs/loader.js:720:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (C:\project\node_modules\#poppinss\utils\build\src\Helpers\index.js:56:31)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
Looks like after updating to latest 'release' version of adonis 5 this issue has been resolved. Stupid preview issues
#poppinss\utils\build\src\Helpers\string.js:241 uses optional chaining which is only supported from Node.js 14
Using Node.js v14.15 will fix the problem.
I personally had this problem with Node.js 12 and Node.js 14.16. I switched to Node.js v14.15.1 and it worked instantly.
It's the Lucid package. Running npm i #adonisjs/lucid#latest solves the issue.
I'm trying to execute this code but I don't know why it shows error. I'm new at Nodejs, so i attach the code and ss of error please help how to fix this
var webshot = require('webshot');
var flatiron = require('flatiron');
var app = flatiron.app;
app.use(flatiron.plugins.http);
app.router.get('/getImage', function() {
var self = this;
var requestUrl = this.req.headers['head'];
console.log(requestUrl);
webshot(requestUrl, function(err, renderStream) {
renderStream.pipe(self.res);
});
});
app.start(3000,"IP Address");
console.log('Starting Node Server');
error =
Debugger attached.
Waiting for the debugger to disconnect...
fs.js:45
} = primordials;
^
ReferenceError: primordials is not defined
at fs.js:45:5
at req_ (c:\Users\HOME\Desktop\NodeScripts\node_modules\natives\index.js:143:24)
at Object.req [as require] (c:\Users\HOME\Desktop\NodeScripts\node_modules\natives\index.js:55:10)
at Object.<anonymous> (c:\Users\HOME\Desktop\NodeScripts\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
Process exited with code 1
First note encountering this kind of issue is not common when using Node.js. The packages webshot and flatiron haven't been maintained for 5 years at the time of writing, which is the primary reason they're incompatible with the current version of Node.js.
Typically when this error is encountered, you either need to use different packages, or downgrade to an older version of Node.js. According to the comments here, you should be able to downgrade to Node.js v11, but I highly suggest exploring more recently maintained packages like capture-website and express in order to stick with the latest LTS version of Node.js.
I am getting the below error when trying to use IBM_DB for db2 access.
$ node nodetest.js
C:\Users\workspace\nodetest\node_modules\bindings\bindings.js:79
throw e
^
Error: Module version mismatch. Expected 47, got 46.
at Error (native)
at Object.Module._extensions..node (module.js:440:18)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at bindings (C:\Users\workspace\nodetest\node_modules\bindings\bindings.js:74:15)
at Object.<anonymous> (C:\Users\workspace\nodetest\node_modules\ibm_db\lib\odbc.js:27:31)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
Here is the code I'm using:
var http = require("http");
var ibmdb = require("ibm_db");
console.log("Test program to access DB2 sample database");
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8081);
console.log('Server running at 127.0.0.1:8081/');
Can someone please help me on this ?
I know this is a 1 year old question but I think it requires at least one correct explanation/answer for that question here, so that future readers might not get confused.
Error: Module version mismatch. Expected 47, got 46.
You will encounter with this error mostly on Windows platform, and this is actually not a bug or defect, this is simply because node-ibm_db does not support particular node version (which you are using for installing node-ibm_db on windows platform).
Reason: node-ibm_db provides pre-compiled node binaries within the module for particular main node-versions (like 4.x, 6.x etc),module do not compile at installing time (on windows only), it uses the pre-compiled binaries to installation and setup.
Hence if you use a latest major version of nodejs and specifically that,- which node-ibm_db is not supporting yet (or simply pre-compiled binaries are not available), you will get this error.
Requirejs with nodejs doesn't tell me the line number of the error, just the error
For example the result is: Error: Evaluating ccc.js as module "ccc" failed with error: SyntaxError: Unexpected token ,
And then the stack:
at Function.req.load (D:\web\pc\node_modules\requirejs\bin\r.js:2470:23)
at Object.context.load (D:\web\pc\node_modules\requirejs\bin\r.js:1858:21)
at Object.Module.load (D:\web\pc\node_modules\requirejs\bin\r.js:1059:29)
at Object.Module.fetch (D:\web\pc\node_modules\requirejs\bin\r.js:1049:66)
at Object.Module.check (D:\web\pc\node_modules\requirejs\bin\r.js:1079:26)
at Object.Module.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1376:22)
at Object.context.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1730:39)
at Object.<anonymous> (D:\web\pc\node_modules\requirejs\bin\r.js:1361:33)
at g (D:\web\pc\node_modules\requirejs\bin\r.js:363:23)
at each (D:\web\pc\node_modules\requirejs\bin\r.js:291:31)
at Object.Module.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1323:17)
at Object.Module.init (D:\web\pc\node_modules\requirejs\bin\r.js:1013:26)
at callGetModule (D:\web\pc\node_modules\requirejs\bin\r.js:1403:63)
at Object.context.completeLoad (D:\web\pc\node_modules\requirejs\bin\r.js:1763:21)
at Function.req.load (D:\web\pc\node_modules\requirejs\bin\r.js:2510:17)
at Object.context.load (D:\web\pc\node_modules\requirejs\bin\r.js:1858:21)
at Object.Module.load (D:\web\pc\node_modules\requirejs\bin\r.js:1059:29)
at Object.Module.fetch (D:\web\pc\node_modules\requirejs\bin\r.js:1049:66)
at Object.Module.check (D:\web\pc\node_modules\requirejs\bin\r.js:1079:26)
at Object.Module.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1376:22)
at Object.context.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1730:39)
at Object.<anonymous> (D:\web\pc\node_modules\requirejs\bin\r.js:1361:33)
at g (D:\web\pc\node_modules\requirejs\bin\r.js:363:23)
at each (D:\web\pc\node_modules\requirejs\bin\r.js:291:31)
at Object.Module.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1323:17)
at Object.Module.init (D:\web\pc\node_modules\requirejs\bin\r.js:1013:26)
at Object.context.makeRequire.mixin.isBrowser [as _onTimeout] (D:\web\pc\node_modules\requirejs\bin\r.js:1646:36)
at Timer.list.ontimeout (timers.js:101:19)
And where the error is? I know the file but what line?
thanks for help
It's not a problem with requirejs and was fixed in nodejs version 0.12.
Unfortunately, there are not enough hooks into vm.runInThisContext in
older node versions to get to the information.
More info you can find here
So, nodejs v.0.10 doesn't want to show additional info about problem. But if you want - you can install newest version of nodejs and gets more info about syntax errors in "required" files.
By the way, with Docker it's pretty easy - all you need just pull repo from node:0.12.