Switch version of Node.js to 6.11.5 on Windows - javascript

I'm using node v8.2.1, but Google Cloud Functions only supports v6.11.5, so I'm looking to switch my node version accordingly (preferably only using npm). How can I do this?
How to change to an older version of node.js, the most relevant source I found, has dated answers for Windows. Using nvmw doesn't work for me, I get:
$- nvmw install 6.11.5
ERROR: The system was unable to find the specified registry key or value.

I also recommend you to try nvm-windows. It will let you install multiple node versions and allow to switch between them. But you need to remove all your previous node installations and related directories first. Depends on your machine, in Windows 10 sometimes got some issues (I was having some problems also when first time install it on my Windows 10) but somehow able to fix it and it's worked for me.

I'm not sure are you asking to change nodejs version for Windows or Google cloud
For Windows I'll highly recommend NVM for Windows, but you'll need to try it yourself, I don't know is it because my customize setting on my PC or what it doesn't success on my side

Related

How to fix VS Code unable to create a strapi app?

I'm Having an issue that ruins my entire development plans, And I don't think I'm even the problem!
There is an headless CMS program (open source) called Strapi, If you know the program then good, If not, Your more than welcome to try and tell me if you can help me with this problem.
I'm having trouble creating a Strapi app in VSCode.
The error that I'm receiving is:
You are running Node.js 18.4.0
Strapi requires Node.js >=14.19.1 <=16.x.x
Please make sure to use the right version of Node.
But, The fault isn't on me, I have 16.17.0 version of node installed, and without a trace of the 18.4 version specified on the error code.
I tried uninstalling node, Changing the dependencies in the launch.json file, Nothing worked!
So I Found the solution, the problem was with the version, the recommended 16.17.0 version of node not working with strapi, the 16.15.0 works actually.

Auto-update path to node-gyp include files in a Visual Studio C++ project

I'm trying to convert a project that compiles just fine on MacOS and Linux (Raspbian in particular) so that it will compile on Windows. (Full code here: https://github.com/kshetline/rpi-acu-rite-temperature)
After much grief (Like somehow the Node 12 I'd installed going away and getting replaced by Node 8 without my knowledge, and on Windows C++ long and int are both 32-bit? Really!?) I've finally made the code to compile using both node-gyp and Visual Studio 2019, but the Visual Studio set-up is fixed to a specific version of Node in a way that I don't like.
Here's my CppProperties.json file:
{
"configurations": [
{
"inheritEnvironments": [
"msvc_x86"
],
"name": "x86-Debug",
"includePath": [
"${env.INCLUDE}",
"${env.LOCALAPPDATA}\\node-gyp\\Cache\\12.16.1\\include\\node\\**",
"${workspaceRoot}\\**"
],
"defines": [
"WIN32",
"_DEBUG",
"NAPI_CPP_EXCEPTIONS",
"UNICODE",
"_UNICODE",
"USE_FAKE_PIGPIO"
],
"intelliSenseMode": "windows-msvc-x86"
}
]
}
I don't want to have to put a specific version of Node in my include path, but I don't know how to make this work without it. I can't even make it work for a specific major version of Node by using 12.* or 12.** -- wildcards don't seem to work for me there.
I see no Windows environment variable that would let me use something like, say, ${env.NODE_VERSION}, and AFAIK there's no VS pre-defined variable that would handle this either.
I could use my own environment variable, but that would have to be manually updated, which is what I'm trying to avoid.
Does Visual Studio have a way that I could script an update, like somehow doing the command node --version, stripping off the leading letter 'v' from the output, and then putting the result into an environment variable?
Any other possible solutions?
Update:
I changed the set-up of my Visual Studio project by starting with a generic command-line app, and the configuration works totally differently, with no CppProperties.json file at all, but the issue is still basically the same -- I now have $(LOCALAPPDATA)\node-gyp\Cache\12.16.1\include\node entered into a config dialog instead.
An addon using node-addon-api must, at compile time, target a precise version of node.
That's because N-API is itself "versioned", (with a single digit macro, NAPI_VERSION, currently from 1 to 5, plus the special value NAPI_VERSION_EXPERIMENTAL=2147483647)
As you can see, for example, in the N-API Version Matrix the version 4 is available in node v10.16.0 but NOT in some older v10 releases.
The addon is "retro-linked" (I don't know the name of that technique) to node.exe, and that link is a "delay load" one. That trick allows the addon to use the N-APIfunctions that are in the host executable, even if it's not "node.exe" (hence the use of win_delay_load_hook.cc).
As for CppProperties.json file, it is my understanding that it's only used by Intellisence and is not related to headers used at compile time.
You can force node-gyp to use a specific version of node, unrelated to the current version installed on the machine, with the --target option to the configure command.
Another useful option is --devdir, which allows to get rid of the infamous (afaic) %localappdata%\node-gyp\Cache root directory.
All the node-gyp command options are here
Please, dear node/node_gyp/N-API experts reading this, don't hesitate to signal/fix errors in that answer.

The project type is not supported by this installation in Visual Studio 2015

I'm trying to create a Windows JavaScript app. Every time I do, i get this error:
The project file 'C:\Users\Matt\AppData\Local\Temp\qugu4hsq.ibc\Temp\Test.jsproj' cannot be opened.
The project type is not supported by this installation
I've looked up a solution, and it involves editing the jsproj file, but in source/repos/test, only the .vs, Test, and Test.sln files/folders exist.
I've looked in the temporary folder, and qugu4hsq.ibc doesn't exist. Is it because the Windows Universal C# apps require I upgrade to windows 10 to use?
See this:
https://developercommunity.visualstudio.com/content/problem/159626/jsproj-cannot-be-opened-project-type-not-supported.html
Specifically:
It's working for me now. To fix, I had to uninstall the "Universal Windows Platform development" workload. And then reinstall it. Then in the individual components, I had to manually make sure that all the Windows 10 SDKs were checked.
Good luck

[React-Native]RN Version Upgrade Wiped Out Android Plugin Projects

I was trying to upgrade my RN from 0.19 to 0.27 using the commands from the doc,
i.e.
npm install --save react-native#0.27
react-native upgrade (I chose the overwrite option when asked to update the latest RN files)
The npm install step worked fine but the upgrade step wiped out all my code in android plugin folders and any changes made to MainActivity.java. My environment is : MacOS, Genymotion, Android development
Thanks!
You've missed that react-native upgrade asked you if you want to overwrite your files. react-native upgrade replaces your files with newer version if it's different than the default one. It does not merge your changes. Also jump from 0.19 to 0.27 is a big one so probably there was a lot of changes.
Yes, react-native upgrade will wipe everything out. There's a command line option now (react-native link) that will put most of it back in, but not everything.
If you choose not to overwrite the files you are risking not including something very important and it may break the upgrade.
I don't know of a good way around this. My process is to use a good ide that shows me exactly what has changed between upgrades. Then I go though each change and see if I'm missing something. The java code and android studio files tend to be quite easy. But the xCode stuff is not, the pbxproj file is particularly awkward. You mostly need to reconstruct it by using Xcode. So... every time you do something to the xCode project, make a note of it! Yes this is a terrible solution, but I don't know what else to do.
I've ended up making detailed notes about everything I do during an upgrade. And I upgrade recently because its easy to forget.

Cannot run Meteor js 1.1 on windows 8.1

I have tried to install meteor js 1.1 on windows 8.1 with the official installer:
https://github.com/meteor/meteor/wiki/Preview-of-Meteor-on-Windows
But even after restarting my computer, when I type the command meteor in the command prompt I get the error command not found.
Even after a search on my computer to find the installation folder of meteor, I am unable to find the answer. However, in the add/remove program utility, I can see meteor.exe.
As a note, I already successfully installed meteor before, and it used to run smoothly. In the meantime, I have removed and re-installed node, and it seems that since this moment the command meteor does not work anymore. Hence my attempt to re-install it.
Does anyone have any idea about how to troubleshoot my issue ?
I just solved my issue by using the windows command prompt instead of the git bash
It appears that only windows command prompt is supported so far.
You can try to manually add Meteor to your Path.
Go to "Environment variables" (you can find it by doing a simple search in your welcome screen) and add the following entry:
C:\\Users\\**your_user_name**\\AppData\\Local\\.meteor
Do not forget to separate this entry from other entries by a semicolon ;.

Categories

Resources