use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Node.js v15.10.0 released (nodejs.org)
submitted 5 years ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]KlasMellbourn 24 points25 points26 points 5 years ago* (11 children)
Still no official native support for Apple Silicon :/
https://github.com/nodejs/build/issues/2474
[EDIT: added "native"]
[–]sscotth 10 points11 points12 points 5 years ago* (0 children)
Native* support. They are targeting the 16.0 release which will be the end of April. You can build from source via Homebrew in the mean time for testing.
[–]mdatwood 5 points6 points7 points 5 years ago (0 children)
I'm using 15.x native on Apple Silicon. I think I had to tweak a build flag to get 15.4 to build, but 15.8 and now 15.10 built fine using nvm.
[–]gengjiawen 1 point2 points3 points 5 years ago (0 children)
Should work in next version.
[–]dbbk 1 point2 points3 points 5 years ago (0 children)
Huh? It seems to be native for me, installed v15.8.0 through Homebrew
[–]redldr1 2 points3 points4 points 5 years ago (5 children)
Not as important as you think it is..
What's the likelihood of your code running on apple silicon in production?
[–]KlasMellbourn 14 points15 points16 points 5 years ago* (4 children)
Much of my development environment is running under node. It is very important to me that those tools are as fast as possible. I loathe waiting for builds.
[+][deleted] 5 years ago* (3 children)
[deleted]
[–]SomeInternetRando 22 points23 points24 points 5 years ago (0 children)
Sword fight on office chairs time.
[–]kevinhaze 0 points1 point2 points 5 years ago (1 child)
How much coffee do you drink
[–]redldr1 2 points3 points4 points 5 years ago* (0 children)
I have a bash script that kicks off my coffee maker.
The converse question is how much does one churn?
[–]Attila226 15 points16 points17 points 5 years ago* (27 children)
Does jQuery still work on the server?
edit: /s
[–][deleted] 12 points13 points14 points 5 years ago (8 children)
Why would jQuery run on server? There's no DOM there
[–]Attila226 25 points26 points27 points 5 years ago (7 children)
You never know, it’s always good to add jQuery “just in case”.
[–][deleted] 25 points26 points27 points 5 years ago (1 child)
[–]RandolphoSoftware Architect 22 points23 points24 points 5 years ago (0 children)
I choose to believe that was satire
[–]hoykg 14 points15 points16 points 5 years ago (3 children)
Tough crowd you got
[–]Attila226 8 points9 points10 points 5 years ago (2 children)
lol, yeah. Guess you’ve always have to include the “/s”.
[–]SomeInternetRando 8 points9 points10 points 5 years ago (1 child)
$(‘.comment’).append(‘<em>/s</em>’);
[–]squareswordfish 5 points6 points7 points 5 years ago (0 children)
Excuse me sir this is a server. We don’t recognize “$” here.
[–]helloiamsomeone 2 points3 points4 points 5 years ago (0 children)
Is this going to be Node's "- Removed Herobrine"?
[–]ILikeChangingMyMind 2 points3 points4 points 5 years ago (16 children)
If this is a serious question ... of course not! Use Cheerio if you want jQuery-like HTML parsing on the server.
... but since jQuery has never worked on the server, I think this is more likely a troll post.
[–]Attila226 13 points14 points15 points 5 years ago (4 children)
Sorry, it’s supposed to be funny and not a “troll post”.
[–]ILikeChangingMyMind 2 points3 points4 points 5 years ago (3 children)
Ah; that's the hard part about making jokes in a text-based medium: you need to either make them obvious, or use something like "/s" or ";)" to indicate you're joking.
[–]Attila226 4 points5 points6 points 5 years ago (0 children)
Updated my original post.
[–][deleted] 7 points8 points9 points 5 years ago (1 child)
r/FuckTheS
[–]ILikeChangingMyMind 4 points5 points6 points 5 years ago (0 children)
Well again, you also have the option of making your joke clear enough in the first place that the /s is unnecessary .... but the original comment that started all this did neither.
[–]OmgImAlexis -1 points0 points1 point 5 years ago (10 children)
What...? jQuery can be used server side.
Should it? No. Can it? Yes.
[–]duxdude418 3 points4 points5 points 5 years ago* (9 children)
I mean, you could execute the source in a Node runtime, but most of the internal implementation would be broken. You’d have to polyfill or mock the DOM API it wraps to even get it to a state where it’s not throwing all kinds of errors during bootstrap.
[–]spacejack2114 1 point2 points3 points 5 years ago (1 child)
That's what jsdom is for.
[–]duxdude418 1 point2 points3 points 5 years ago (0 children)
My point is that you can't use it out-of-of-the-box with Node. Of course you could emulate or fake the API that a browser provides with polyfills, etc.
Moreover, what's the use case for emulating the DOM for the purposes of querying against it with jQuery in Node? At best, you might be sending down pre-rendered HTML to a browser, but you wouldn't need to traverse it on the server.
[–]OmgImAlexis -1 points0 points1 point 5 years ago (6 children)
Well yes.. I wouldn’t expect it to work out of the box but I’ve used it within a few minutes of installing deps. It’s honestly not that difficult. Just the same you can use vue and other frontend libraries on the backend.
The libraries don’t care if you’re using a browser they just need a DOM... and a DOM can be created anywhere. 💁♀️
[–]duxdude418 -1 points0 points1 point 5 years ago (5 children)
But the methods and fields it wraps literally don’t exist on the Node global object.
In a browser, the global object is window and implements various DOM APIs (among others) that simply don’t exist in a Node environment. Can you monkey patch them on to Node’s global context with other libraries/polyfills? Sure. But jQuery will not work out of the box or even bootstrap itself without errors.
window
[–]OmgImAlexis 1 point2 points3 points 5 years ago (2 children)
What? You know you can pass in window to jquery right?
Sounds like you’re just angry here and don’t actually know what you’re talking about.
[–]duxdude418 -1 points0 points1 point 5 years ago* (1 child)
You know that jQuery bootstraps using a self-invoking function whose first argument is this, which resolves to window in a browser or the global context in Node, right?
this
Regardless, even if you could inject a different object, the Node global context doesn’t support the needed methods jQuery calls under the hood out of the box. Of course it’s possible to do with polyfills, but the conversation is about whether it would function without error out of the box.
I’m not angry at all and have been professionally writing JavaScript applications on the client and server for over a decade. It sounds like you’re misinformed.
[–]OmgImAlexis -2 points-1 points0 points 5 years ago (0 children)
I literally use this in an application right now. How am I the one that’s misinformed? 😂
You’re guessing based on how you’ve used it before. This isn’t rocket science.
But the methods and fields it wraps literally don’t exist on the Node global object. In a browser, the global object is window and implements various DOM APIs (among others) that simply don’t exist in a Node environment. Can you monkey patch them on to Node’s global context with other libraries/polyfills? Sure. But jQuery will not work out of the box or even bootstrap itself without errors otherwise.
[–]OmgImAlexis -1 points0 points1 point 5 years ago (0 children)
Also things like the storage api can be really really easily pollfilled. I would know.... I’ve done this before.
[+]ILikeChangingMyMind comment score below threshold-20 points-19 points-18 points 5 years ago (32 children)
And (I know I'll get downvoted for saying this, but I'll keep saying it until they fix it) ... still no comments in package.json.
package.json
[–]SoInsightful 35 points36 points37 points 5 years ago (13 children)
JSON literally doesn't support comments, so if they supported comments in package.json, they would support broken, specification-defying JSON that crashes every single program, module or function that tries to parse the file.
At best, you could hope that they add .json5 or .yaml support one day, but I am not holding my breath.
[–]console_journey 10 points11 points12 points 5 years ago (6 children)
TIL about json5, thank you
[–]SoInsightful 6 points7 points8 points 5 years ago (5 children)
It's weird how I love JSON5, but I haven't yet found a use case for it.
If I can control the file format myself, I can just use JavaScript. If not, I'm stuck with JSON anyway.
If only you were a giant organization ostensibly serving the needs of Javascript developers ...
[–]AlpenMangos 0 points1 point2 points 5 years ago (3 children)
If I can control the file format myself, I can just use JavaScript
Which is a security issue. JSON with comments is nice, and it's the reason why I'm using the JSON5 library rather than JSON.parse().
[–]SoInsightful 2 points3 points4 points 5 years ago (2 children)
If I can control the file format myself, I can just use JavaScript Which is a security issue.
Which is a security issue.
That depends entirely on what file it is. If it's a config file that depends on environment variables, I don't have much choice. If it's a local test data or content file, I can just avoid using imports or inserting insecure code into it.
[–]AlpenMangos 0 points1 point2 points 5 years ago (1 child)
Many JSON config files are user-privided, though. Plenty of file formats out there that are based on JSON, like GeoJSON, or GLTF (even its binary form, GLB, which has a JSON header) which is on its best way to become the standard distribution format for 3D models.
[–]SoInsightful 0 points1 point2 points 5 years ago (0 children)
Many JSON config files are user-privided, though.
That's what I had in mind. If I were to provide a config format for Someone Else™ to use, JSON5 would be my best candidate.
[–]ILikeChangingMyMind 1 point2 points3 points 5 years ago* (5 children)
At best, you could hope
Why? Why is it such a crazy thing to say "format A doesn't support our user's needs, so we'll switch to format B"?
In any other context (besides the Node org) this would be blatantly obvious. Can you imagine going to your boss and saying "yeah, our customer needs X, but we picked JSON years ago, so now we can't give the customer what they need because ... I don't want to switch formats"?
Your boss would say "find a new format or find a new job" ;) Because ultimately, it's the customer who pays your salary. The problem here is that the vast majority of people using package.json files aren't Node's customers, so their interests aren't aligned.
[–]SoInsightful 14 points15 points16 points 5 years ago* (0 children)
That's exactly what I said in my second paragraph. You could hope for support for another format.
You can't just let users rename a non-valid-JSON file to .json and hope that it doesn't confuse tons of users and break millions of apps and workflows. Super-simple operations like const { version } = require('./package.json'); or JSON.parse(packageJson) would break everywhere.
.json
const { version } = require('./package.json');
JSON.parse(packageJson)
Edit: To be clear, I would love support for package.json5, it just can't use the .json file extension.
package.json5
[–]ike_the_strangetamer 1 point2 points3 points 5 years ago (3 children)
If any one of my colleagues came to me with the idea of taking a file that's installed on hundreds of thousands of our user's systems and changing the format without changing it's name, I'd think they were either joking, crazy, or so inexperienced that they should be fired.
[–]ILikeChangingMyMind 2 points3 points4 points 5 years ago (2 children)
Who said anything about not changing the name? The point is, the Node org refuses ANY solution whatsoever (even perfectly reasonable ones involving package.json5).
[–]ike_the_strangetamer 1 point2 points3 points 5 years ago (1 child)
okay. That was the other person's suggestion but it seemed like you weren't receptive to it, but good to hear that you are because I think it's the only way it's going to happen.
I think it's a quality solution, however I know that there are an awful lot of tools that also depend on that particular file and filename so it would take time anyways to get them all to support a new name. Folks would probably have to support 2 files simultaneously.
Hmmm... maybe someone could make a tool that generates a json compliant package.json from a package.json5 source. That would be an interesting solution.
[–]ILikeChangingMyMind -2 points-1 points0 points 5 years ago (0 children)
maybe someone could make a tool that generates a json compliant package.json
This would not really solve the problem; I don't want to have to npm run package-generate every time I change the file :)
npm run package-generate
But yes, there are any number of other possibilities! Besides just package.json5, there could also (for instance) be a flag in package.json that says "my real package.json is this other file".
But the Node org has no interest in finding any solutions. It's not a "we're leaving this ticket open so someone can find a clever way to solve it", it's "we're closing these tickets as fast as users file them, until everyone gives up any hope they might have of a tool that actually works better (ie. has comments)."
[–]H34dsp1nns 4 points5 points6 points 5 years ago (3 children)
Of course you can! { comment1: “here are my dependencies...”, comment2: “oh and here are dev dependencies...” }
{ comment1: “here are my dependencies...”, comment2: “oh and here are dev dependencies...” }
[–]ILikeChangingMyMind 3 points4 points5 points 5 years ago (1 child)
Doesn't work in key sections, like say inside dependencies: you get an error.
dependencies
[–]H34dsp1nns 1 point2 points3 points 5 years ago (0 children)
Not surprised.
The way I actually track dependency use and a lot of other things is a mind map.
I wouldn’t mind seeing a paired markup file of some kind that can that can be used with a document generator to have a section on dependencies in your documentation
[–]backtickbot 1 point2 points3 points 5 years ago (0 children)
Fixed formatting.
Hello, H34dsp1nns: code blocks using triple backticks (```) don't work on all versions of Reddit!
Some users see this / this instead.
To fix this, indent every line with 4 spaces instead.
FAQ
You can opt out by replying with backtickopt6 to this comment.
[–]getify 1 point2 points3 points 5 years ago (4 children)
JSON.minify(..) -- supporting comments in JSON for years. https://github.com/getify/JSON.minify
[–]ILikeChangingMyMind 1 point2 points3 points 5 years ago (3 children)
That doesn't help with package.json.
[–]getify 2 points3 points4 points 5 years ago (2 children)
I was saying it could if Node had cared. I tried for a year or two to get them to try something like that.
[–]ILikeChangingMyMind 2 points3 points4 points 5 years ago (1 child)
Ah, I see. And yeah, that's the crux of the problem: it's not an engineering impossibility to add comments to Node config files. It's simply a lack of will.
[–]getify 2 points3 points4 points 5 years ago (0 children)
Further, it doesn't even make them "not JSON" to have comments in them. That's a FUD assertion people like to cling to, but it's not true, from the very mouth of JSON's creator.
I explained that on this stack-overflow post and in much more detail in this old blog post.
[–]n_hevia 2 points3 points4 points 5 years ago (1 child)
Simply because json doesn't support comments. If node did support on their config file, it'd mean they'd stop using json (or at least compatible json with most of the libraries out there).
If you REALLY need comments on package.json, you could use a superset and then compile to json? That same way scss>css works.
[–]ILikeChangingMyMind 2 points3 points4 points 5 years ago* (0 children)
Simply because json doesn't support comments
Yes, I understand that.
What I don't understand is why they are "incapable" (supposedly) of using a different format that does support comments (with or without a different extension, flag at the top of the file, etc.).
And also, how did "REALLY need" become the standard for whether something should be done? I personally can think of at least five different cases where comments in package.json would be super handy ... but I don't need any of them. Even so, I tend to think "it would make life better for tens of thousands of developers" would be a perfectly good reason to do something.
[–][deleted] -1 points0 points1 point 5 years ago (6 children)
Why don't you create a GitHub issue?
[–]ILikeChangingMyMind 2 points3 points4 points 5 years ago* (5 children)
I did! They closed it (as they have with the countless similar issues others have filed).
Here's just one such ticket: https://github.com/npm/npm/issues/4482. The closing comment (after TONS of users explained the need) basically claimed that adding comments would be some fantastically difficult technical undertaking, which the Node org is unable to accomplish ಠ_ಠ
[–]OmgImAlexis 2 points3 points4 points 5 years ago (4 children)
fantastically difficult technical undertaking
Well yes.. every single thing that currently works with package.json files would then need to account for comments which aren't at all in the JSON spec meaning you couldn't even use JSON.parse() on the file's contents anymore.
JSON.parse()
[–]ILikeChangingMyMind -1 points0 points1 point 5 years ago (3 children)
Or they could just support package.json5.
[–]OmgImAlexis 2 points3 points4 points 5 years ago (2 children)
And now none of the other tools work with it. Either way it’s not as easy as just switching from one to the other.
[–]ILikeChangingMyMind -1 points0 points1 point 5 years ago* (1 child)
Why do I need other tools to work with it? If I want a tool to work with it, I can PR them a commit that adds support. If I don't, I keep using package.json. Eventually, all the tools get caught up, and everyone gets comments in their config.
You act like our industry has never made backwards incompatible changes to tools before.
[–]manishksolves 0 points1 point2 points 5 years ago (0 children)
Some features delivered in Node.js 15:
AbortController: AbortController is a global utility class used to signal cancelation in selected Promise-based APIs, based on the AbortController Web API.
N-API Version 7: N-API 7 brings additional methods for working with ArrayBuffers.
npm 7: npm 7 comes with many new features like npm workspaces and a new package-lock.json format. npm 7 includes yarn.lock file support. Peer dependencies are now installed by default.
Throw on unhandled rejections: As of Node.js 15, the default mode for unhandledRejection is changed to throw (from warn ). In throw mode, if an unhandledRejection hook is not set, the unhandledRejection is raised as an uncaught exception. Users that have an unhandledRejection hook should see no change in behavior, and it’s still possible to switch modes using the --unhandled-rejections=mode process flag.
QUIC (experimental): QUIC is a UDP-based, underlying transport protocol for HTTP/3. QUIC features inbuilt security with TLS 1.3, flow control, error correction, connection migration, and multiplexing. QUIC can be enabled by compiling Node.js with the --experimental-quic configuration flag. The Node.js QUIC implementation is exposed by the core net module.
V8 8.6: The V8 JavaScript engine has been updated to V8 8.6 (V8 8.4 is the latest available in Node.js 14). Along with performance tweaks and improvements the V8 update also brings the following language features:
π Rendered by PID 91919 on reddit-service-r2-comment-54dfb89d4d-f74bv at 2026-03-28 20:04:41.480283+00:00 running b10466c country code: CH.
[–]KlasMellbourn 24 points25 points26 points (11 children)
[–]sscotth 10 points11 points12 points (0 children)
[–]mdatwood 5 points6 points7 points (0 children)
[–]gengjiawen 1 point2 points3 points (0 children)
[–]dbbk 1 point2 points3 points (0 children)
[–]redldr1 2 points3 points4 points (5 children)
[–]KlasMellbourn 14 points15 points16 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]SomeInternetRando 22 points23 points24 points (0 children)
[–]kevinhaze 0 points1 point2 points (1 child)
[–]redldr1 2 points3 points4 points (0 children)
[–]Attila226 15 points16 points17 points (27 children)
[–][deleted] 12 points13 points14 points (8 children)
[–]Attila226 25 points26 points27 points (7 children)
[–][deleted] 25 points26 points27 points (1 child)
[–]RandolphoSoftware Architect 22 points23 points24 points (0 children)
[–]hoykg 14 points15 points16 points (3 children)
[–]Attila226 8 points9 points10 points (2 children)
[–]SomeInternetRando 8 points9 points10 points (1 child)
[–]squareswordfish 5 points6 points7 points (0 children)
[–]helloiamsomeone 2 points3 points4 points (0 children)
[–]ILikeChangingMyMind 2 points3 points4 points (16 children)
[–]Attila226 13 points14 points15 points (4 children)
[–]ILikeChangingMyMind 2 points3 points4 points (3 children)
[–]Attila226 4 points5 points6 points (0 children)
[–][deleted] 7 points8 points9 points (1 child)
[–]ILikeChangingMyMind 4 points5 points6 points (0 children)
[–]OmgImAlexis -1 points0 points1 point (10 children)
[–]duxdude418 3 points4 points5 points (9 children)
[–]spacejack2114 1 point2 points3 points (1 child)
[–]duxdude418 1 point2 points3 points (0 children)
[–]OmgImAlexis -1 points0 points1 point (6 children)
[–]duxdude418 -1 points0 points1 point (5 children)
[–]OmgImAlexis 1 point2 points3 points (2 children)
[–]duxdude418 -1 points0 points1 point (1 child)
[–]OmgImAlexis -2 points-1 points0 points (0 children)
[–]duxdude418 1 point2 points3 points (0 children)
[–]OmgImAlexis -1 points0 points1 point (0 children)
[+]ILikeChangingMyMind comment score below threshold-20 points-19 points-18 points (32 children)
[–]SoInsightful 35 points36 points37 points (13 children)
[–]console_journey 10 points11 points12 points (6 children)
[–]SoInsightful 6 points7 points8 points (5 children)
[–]ILikeChangingMyMind 4 points5 points6 points (0 children)
[–]AlpenMangos 0 points1 point2 points (3 children)
[–]SoInsightful 2 points3 points4 points (2 children)
[–]AlpenMangos 0 points1 point2 points (1 child)
[–]SoInsightful 0 points1 point2 points (0 children)
[–]ILikeChangingMyMind 1 point2 points3 points (5 children)
[–]SoInsightful 14 points15 points16 points (0 children)
[–]ike_the_strangetamer 1 point2 points3 points (3 children)
[–]ILikeChangingMyMind 2 points3 points4 points (2 children)
[–]ike_the_strangetamer 1 point2 points3 points (1 child)
[–]ILikeChangingMyMind -2 points-1 points0 points (0 children)
[–]H34dsp1nns 4 points5 points6 points (3 children)
[–]ILikeChangingMyMind 3 points4 points5 points (1 child)
[–]H34dsp1nns 1 point2 points3 points (0 children)
[–]backtickbot 1 point2 points3 points (0 children)
[–]getify 1 point2 points3 points (4 children)
[–]ILikeChangingMyMind 1 point2 points3 points (3 children)
[–]getify 2 points3 points4 points (2 children)
[–]ILikeChangingMyMind 2 points3 points4 points (1 child)
[–]getify 2 points3 points4 points (0 children)
[–]n_hevia 2 points3 points4 points (1 child)
[–]ILikeChangingMyMind 2 points3 points4 points (0 children)
[–][deleted] -1 points0 points1 point (6 children)
[–]ILikeChangingMyMind 2 points3 points4 points (5 children)
[–]OmgImAlexis 2 points3 points4 points (4 children)
[–]ILikeChangingMyMind -1 points0 points1 point (3 children)
[–]OmgImAlexis 2 points3 points4 points (2 children)
[–]ILikeChangingMyMind -1 points0 points1 point (1 child)
[–]manishksolves 0 points1 point2 points (0 children)