Using Node.js 4.5.0 I got the expected behaviour
> console.log(Number.isInteger(42))
true
but using Node.js 0.10.36 I got the error
> console.log(Number.isInteger(42))
TypeError: Object function Number() { [native code] } has no method 'isInteger'
How I know which is the minimal version of Node.js required for using the
Number.isInteger method?
I couldn't find any related information after grepping Node.js CHANGELOG files.
Edit 1: node.green shows that the method is supported from Node.js 0.12.16.
Edit 2: Neither could I find any related information in V8 CHANGELOG.
As they recommend to look after in their docs, Number.isInteger is supported in version 0.12.16. Though that's not the minimum version, which might be 0.12.3 which uses the same v8 engine version.
Edit #1: In this commit V8 3.24.11 was released, but Node.js only made use of V8 3.25.30.0 in version 0.11.13. Furthermore, I made some tests (in Xubuntu 16.04):
Node.js v0.11.13 (V8 3.25.30.0)
> Number.isInteger(42)
true
Node.js v0.11.12 (V8 3.22.24.19)
> Number.isInteger(42)
TypeError: Object function Number() { [native code] } has no method 'isInteger'
at repl:1:8
at REPLServer.defaultEval (repl.js:130:27)
at bound (domain.js:255:14)
at REPLServer.runBound [as eval] (domain.js:268:12)
at REPLServer.<anonymous> (repl.js:277:12)
at REPLServer.EventEmitter.emit (events.js:104:17)
at REPLServer.Interface._onLine (readline.js:202:10)
at REPLServer.Interface._line (readline.js:531:8)
at REPLServer.Interface._ttyWrite (readline.js:806:14)
at ReadStream.onkeypress (readline.js:101:10)
Notice that in Node.js v0.11.12, V8 3.22.24.19 is lower than 3.24.11 which is when they added Number.isInteger. So, in conclusion, Node.js v0.11.13 is the minimal version that has method 'isInteger'.
Number.isInteger() was added in V8 3.26.30 (see this commit pointed out here), so the minimal version of Node.js supporting this method is 0.12.0.
Number.isInteger() is defined in ES6; it requires a Node version that implements ES6.
Related
I am using node module on-exit-leak-free (https://www.npmjs.com/package/on-exit-leak-free) but got the error below since I use the older node version (< v14).
ReferenceError: FinalizationRegistry is not defined
at Object.<anonymous> (.../node_modules/on-exit-leak-free/index.js:11:18)
I could solve the issue by updating node version to v14+, but in case I want to keep the older version (below v14), is there any alternative to this module?
I am installing a project in vuejs but me display this error does any idea how to solve it.
D:\> vue create crud-app
node:os:68
throw new ERR_SYSTEM_ERROR(ctx);
^
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_gethostname returned ENOSYS (function not implemented)
at new Defaults (C:\node32\node_modules\#vue\cli\node_modules\#achrinza\node -ipc\entities\Defaults.js:26:20)
at new Parser (C:\node32\node_modules\#vue\cli\node_modules\#achrinza\node-i pc\entities\EventParser.js:8:14)
at Object.<anonymous> (C:\node32\node_modules\#vue\cli\node_modules\#achrinza\node-ipc\dao\client.js:11:19)
Judging by how the window looks in your screenshot, you might be using Windows 7.
If so, the last version of Node.js with official Windows 7 support is either v13.6.0, v13.14.0 or v14 (conflicting sources). You're using v16.14.0, which is too new.
There seems to be a workaround to install newer versions, see here: https://stackoverflow.com/a/64626035
I cannot comment on how well it works, or if it works at all.
I am trying to run a Testcafe test but get the following Error. This used to work until I recently updated npm and Node.
npm test
> e2e-tests#1.0.0 test
> node index.js test
TypeError: details.family.toLowerCase is not a function
at C:\mac\github\e2e-tests\node_modules\ip\lib\ip.js:385:39
at Array.filter (<anonymous>)
at C:\mac\github\e2e-tests\node_modules\ip\lib\ip.js:384:37
at Array.map (<anonymous>)
at ip.address (C:\mac\e2e-tests\node_modules\ip\lib\ip.js:379:37)
at Proxy.getIPAddress (C:\mac\e2e-tests\node_modules\endpoint-utils\index.js:109:15)
at getValidHostname (C:\mac\e2e-tests\node_modules\testcafe\lib\index.js:26:34)
at createTestCafe (C:\mac\e2e-tests\node_modules\testcafe\lib\index.js:71:9)
at async run (C:\mac\e2e-tests\test-runner.js:40:20)
at async testRunner (C:\mac\e2e-tests\test-runner.js:117:10)
at async start (C:\mac\e2e-tests\index.js:9:22)
This appears to be a bug with version 18 of node, interacting with the ip package (used in lots of popular libraries like Storybook and next ui).
You can try over-riding to use the latest version of ip:
{
"overrides": {
"ip": "1.1.8"
}
}
But - in my case at least - I ran into further issues with that approach. The only "fix" for now is to downgrade to use the long-term support (LTS) version of node/npm (currently 16.15.1) rather than 17/18. I highly recommend nvm, which will let you just do nvm install lts.
I am using puppeteer in my latest project. I installed the library using NPM (npm i puppeteer). From the documentation I understood that page.waitFor() function was now deprecated and replaced by page.waitForTimeout().
When I try to use the new function I get UnhandledPromiseRejectionWarning: TypeError: page.waitForTimeout is not a function.
What could be the possible reason? The version of puppeteer I got from NPM is 2.1.1.
Thanks
page.waitForTimeout has been introduced in puppeteer version 5.3.0.
So as was mentioned in the comments, you can't use this new function in version 2.1.1 you had installed.
Bonus: Issue #6214 contains more details to this topic.
According to their documentation, all one needs to do is require the moment-isocalendar module.
This does not work:
var m = require("moment");
var i = require("moment-isocalendar");
m().isocalendar();
It throws
TypeError: Object Tue Aug 13 2013 18:20:36 GMT+0300 has no method 'isocalendar'
at repl:1:6
at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.EventEmitter.emit (events.js:98:17)
at emitKey (readline.js:1095:12)
I looked at the module (all were installed with npm), and it requires the "moment" and monkey-patches it. I tried requiring the moment-isocalendar before the moment module, but got the same result. The moment-isocalendar is an empty object after the monkey-patch {}.
Has anyone used a momentjs plugin in nodejs before? Any ideas how to make this work?
Later edit
It works in nodejs v0.10.12, it doesn't work in nodejs v0.10.15. I added an answer.
Later edit
I'm running Ubuntu 13.04 with 3.8.0-26-generic kernel, and the nodejs is installed via package manager from ppa:chris-lea/node.js
moment-isocalendar is a plugin, not part of the main moment.js library. My guess is that they didn't update it for the last moment.js release, but I have not verified this.
You should raise an issue here: https://github.com/fusionbox/moment-isocalendar
After a little research, the answer is simple: it is not working. It was relying on an older nodejs feature (bug) where you could monkey-patch the in-memory modules after their first require, which apparently doesn't work anymore (worked in 0.10.12, doesn't work in 0.10.15).
If anyone gets the module as-is working i'll change the right answer.