Compatibility issues Node and Strapi4 - node.js

allow me to walk you through some problems I'm encountering when setting up Gatsby with Strapi. Hopefully, somebody can provide me with a solution. Whenever I use the following command yarn create strapi-starter strapi-test gatsby-blog I get the following error:
So what I do next is switching to node v15 using nvm to make strapi compatible with node. The result being that some packages are being installed followed by yet another compatibility error:
Therefore, I am wondering what I am doing wrong and how to make strapi4 compatible with node without having the errors above?

Use Node.js v16 rather than v15. It should fix the issue.
Besides, it's better to use even-numbered version of Node.js, as they're LTS.

Related

NodeJS-MSMQ: SyntaxError: Cannot use import statement outside a module

I'm pretty new with NodeJS and I'm trying to use a module called "updated-node-msmq" (from this repository) in my project but getting an error.
What I've done:
I opened a new folder for the project.
I used the command "$ npm install --save updated-node-msmq" and got some warnings (Screenshot attached).
When I try to use the module according to the README, and run my "test.js" file I got the following error here in the screenshot).
I am using version 14.16.0 of NodeJS and after trying to fix this myself I realized that probably the problem is that the module was built for older versions of NodeJS.
I understand that low version is not a recommended solution, but I have no clue how to update a module.
Help / guidance in solving the problem?
Thanks in advance everyone!
Why are you using updated-node-msmq? That package seems like a mess, and the errors you are getting is because the whole module is written with ES2015 but doesn't seem to have been transpiled to node.js compatible code before published to NPM.
I'd advise you to use a tried and tested module for MSMQ first and foremost.
EDIT: Seems like the author fucked up in the 0.2.0 version. You could use the 0.1.9 (by instead using npm install updated-node-msmq#0.1.9 but that one is 3 years old.

Is there a way to RUN multiple versions of Node.js simultaneously on Windows?

So, to be clear, I'm not asking about the possibility of INSTALLING multiple versions of Node, or the capability of switching between multiple versions with something like nvm.
(The original nvm package for Mac/Linux has an "exec" command that lets you run a command under a particular version of node. I think this would be a solution--but the nvm for Windows package doesn't have that "exec" command.)
Context:
I have an Azure function app API that must run under Node 14.0.0 (a requirement of Azure Function Core Tools version ~3, which itself is a customer requirement).
I also have a basic React app (using Parcel bundler) that runs under Node 11.14.0. I can't update the Node version to 14.0.0 because of an error ("Cannot locate the bindings file...").
For testing purposes, I need to run both simultaneously, so I can hit my API with my React app.
I have tried starting my API under Node 14.0.0, then using nvm to switch to 11.14.0 to run the React app, but it causes the API to fail with an "unsupported Node version" error. I haven't tried the converse approach because this error (along with the UAC prompt) tells me that the Node version in use is global.
Does anyone have any ideas of how to run two versions of Node on Windows? Or can anyone suggest another practical work-around?
Thanks in advance.

Which version of Socket.IO am I running?

Recently, I installed a new version of Socket.IO with npm. I tried using npm update socket.io, but that didn't seem to work for me because when I checked the version using npm list socket.io, it didn't show as a new version. So, I just used npm install socket.io, which seemed to work, because if I now go to Command Prompt, and enter the command npm list socket.io, I get this:
Brackets is my code editor, and this seems to indicate that it has its own installation of Socket.IO. is this a correct assumption? Anyway, before installing the new version of Socket.IO, the part saying socket.io#2.2.0 wasn't there.
So how do I know which one I'm running? I think it should be 2.2.0, but before installing it, because there was only the 1.1.0 version there, so I must've been originally running that.
By the way, what does extraneous mean in this sense? Thanks for any help.
Try this command, it will tell you the version which is currently being used for the project:
node -p "require('./package.json').version"
And also, it looks like you have a package.json file in brackets directory. I have no idea why. Maybe, it was installed as a part of dependency or it is a dependency.
But if you working in that directory/path, i.e.,
C:\Users\William\node_modules\brackets, socket.io will use version 1.1, otherwise for any other directory/path it will use the version 2.2.
I hope it clears your doubt.

"no template named 'WeakCallbackData' in namespace 'v8'" error when installing npm packages

Some packages that depend on https://www.npmjs.com/package/fibers fail to install with error message above. Particularly it is iron-meteor.
Homepage of the fibers states:
meteor users please read this
If you're trying to get meteor running and you ended up at this page you're probably doing something wrong. Please uninstall all versions of NodeJS and Meteor, then start over. See meteor#5124 for more information."
But it does not seem to be very helpful.
One guy recommends to downgrade node.js here https://github.com/NativeScript/NativeScript/issues/2991
It helps indeed, but it is kind of hack, right?
Node version affected: v7.2.0
Node v6.9.2 works well.
WeakCallbackData was removed from the V8 API earlier this year. Since this change has landed in Node 7, packages that rely on v8::WeakCallbackData don't work anymore. You need to downgrade Node or wait until Meteor supports Node 7, i.e., uses a newer node-fibers version.

When using nvm to manage your node versions, should you point webstorms node interpreter to it?

When you switch to the nvm to manage your node versions, should you point your node interpreter to that one?
ie from /usr/bin/node to the ~/.nvm/v.xxx one
I ask because I'm running into some issues with webstorm when trying to debug node stuff now.
Best thing I've found so far is to add each version to Default 'Node.js and NPM' Settings (rather than in individual Project settings). Then when creating new projects, or updating existing ones, you can select that version from the dropdown instead of having to recreate it for each project.
But it would be nice if the NodeJS Plugin would look for nvm and integrate with it. Or if nvm would create symlink for /usr/bin/node and update that when you change the version.
Yes, you need to explicitly set the Node Interpreter to the version you'd like to use
You should not need to do that, it seems it was a bug that was identified and reported. A fix will be released in the coming 2016.1.3 EAP version of WebStorm.
https://youtrack.jetbrains.com/issue/WEB-21558
As #zenw0lf stated above, WS does now look for installed node versions under .nvm but since .nvm does not yet add an alias for the active version of node, the specified value is fragile as it's version-based.
I've attempted to resurrect the appropriate issue in NVM to alleviate this. Please follow that for updates.

Resources