Node.js version and Google Cloud functions - node.js

I get this message when I start a local Firebase server with firebase serve:
Warning: You're using Node.js v8.9.4 but Google Cloud Functions only supports v6.11.5.
But there is no info about what to do. What do I need to do to downgrade Node.js to v6.11.5? Should I use that version just for Firebase projects and the latest released version of Node.js for other projects? In that case how to I do that?
EDIT: The warning now looks like this and I am unable to run a new nearly empty project:
Warning: You're using Node.js v8.9.4 but Google Cloud Functions only supports v6.11.5.
! functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
! functions: Error from emulator. mod.hasOwnProperty is not a function
So I really think I have to downgrande Node.js. But I do not know how to safely do that. Hm, looking at http://nodejs.org/ I can't even find version v6.11.5?
EDIT 2: Just checked in the new project if npm update --dev fixed the problem. It did not. (Actually no packages where updated.)

That's just a warning. You can ignore it if you know what you're doing. It's telling you that your local emulation of a function (running on node 8.9.4) may not perfectly match what the function will do when it's deployed to Cloud Functions (running 6.11.5). But as long as you're not using any features of node that are not available on node 6.11.5, you won't have a problem. I use newer versions of node to test locally all the time without problems.

You can uninstall and reinstall Cloud Functions emulator and Firebase Tools using the commands provided in the GitHub Troubleshooting guide. Since you are using Firebase, follow the instruction for the ‘Firebase Tools’.

Node v8 is now available for cloud functions:
https://firebase.googleblog.com/2018/08/cloud-functions-for-firebase-config-node-8-timeout-memory-region.html
So I believe this warning can truly be ignored...

There are several tools listed in the answers to this question
For Windows I just used nvmw successfully to accomplish this same task.

You will get the nvm here
After installation of nvm.
just use this command
"nvm install 8.9.1 64bit" you can use any version here or 64bit 32bit according to your system config
after that installation use
"nvm use 8.9.1"

Related

How to update (nodejs14.x) while having node version v16.14.2?

I am beginner in node trying to create rest-api's using node and express. Following the udemy course https://www.udemy.com/course/create-a-rest-api-with-node-js-and-mongo-db/.
In this turbo server is used and site is deployed on that. Now I want to deploy my project on turbo server but getting following error
lenovo#siddhi:~/giftshop-api$ turbo deploy
Deploying to Turbo 360 Hosting Environment...
...............
ERROR: The runtime parameter of nodejs10.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs14.x) while creating or updating functions.
I have installed the node already with version
lenovo#siddhi:~/giftshop-api$ node -v
v16.14.2
How can I use runtime of (nodejs14.x) while creating or updating functions.?
Tried many solutions of from stack overflow but couldn't get it done.
Can anyone help please...
You can install nvm by following the instructions at https://github.com/nvm-sh/nvm
Finally, everything is just
nvm install <node-version>
nvm use <node-version>
You need to run it as admin at cmd

Deploying Node.js app with gdal | AWS Elastic Beanstalk

I'm trying to deploy a node.js app but get stuck with an error about missing dependencies for gdal.
Error: /lib64/libm.so.6: version 'GLIBC_2.27' not found (required by /var/app/current/node_modules/gdal/lib/binding/gdal.node)
How would I go about installing this required dependency?
gdal-async on npm explicitly supports AWS.
As its author, I will be happy to help you if it doesn't work - you can create an issue on github.
I don't know what you call gdal.js.
There is the original gdal by Mapbox and Natural Atlas that is not actively developed anymore.
There is gdal-next on which I used to work a little bit which has a current version of GDAL but it is not very active either.
There is my gdal-async which is the only one that is currently active.
And there is an Emscripten port that is pure JS and runs in the browser, but it is stalled at GDAL 2.
Supporting AWS is simply a matter of compiling with the right libraries.

In the linked question, what does the op talk about regarding installing node.js in the working directory?

I am a complete newbie to all this.
I tried to install node.js 4 times and then again uninstalled it every time trying different things, thinking one of them would work.
The link to the question is-Cannot find runtime 'node' on PATH - Visual Studio Code and Node.js
After I typed $node --version in powershell terminal in VSCode (after installing node.js in C drive, defaulting to all recommended options in the setup) I get an error. I have uploaded the image of the error.
the error
Please tell me how to get node.js working with VSCode.
To get the version of Node, just type node --version in the terminal without the "$".

Use specific versions of npm/node for different VS solutions?

I have a VS 2015 solution which requires I have the newest version of nodejs installed externally, and added to the External Web Tools path. (web project using a packages.json and gulp file to retrieve css/js modules and compile ssas at build time)
I also have older solutions that uses older versions of modules, and worked with the default versions of npm(1.4.9) and node(0.10.31). Once I installed newer nodejs externally and added to External Web Tools path, npm now throws various errors. As I work through errors I tend to to end up at github issues where someone had opened an issue and the responses were "you're using too old a version of node/npm".
In an ideal world we'd work through the old projects to get them on newer versions but this has a larger impact than is feasible.
Is there a way to specify that some projects use the default node/npm while other projects use the newer? I.e. a way to make the External Web Tools paths a proj/sln level setting instead of being a global Visual Studio setting.
You can use something like nvm.
In your project root directory, you would setup a .nvmrc and you would just set the version number in there. For example my file would have v10.9.0, and then I would just go into the directory and from the command line type the following:
nvm use
You can also have nvm set your npm version as well. See this answer
You can use Node Version Manager(NVM) to solve your problem
NVM allow to run multiple node version in single machine, You can switch on any node verion using NVM
for more information you can refer
https://medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47

nodejs: fs.access is undefined

I am using nodejs/express to develop a simple RESTful API.
Yesterday I could make calls to the fs.access method (used to check the existence of a file/folder). I can't today. Even if I use the REPL on the terminal it says fs.access is undefined. This is the output:
> var fs = require('fs');
undefined
> fs.access
undefined
> fs.exists
[Function]
nodejs --version gives me this version, which is the latest available from Ubuntu's repositories: v0.10.25
I know there is the fs.exists method, but as per documentation it has been deprecated.
How can I solve?
Thank you,
Umar
Node.js version 0.10.25 is not the latest and according to it's documentation a function named access is indeed not present in the file system api.
According to the official website, the latest LTS version is 4.2.6 and the latest stable one is 5.5.0. I've just checked and everything works as excepted on my computer using a recent version of Node.js.
If you're having trouble installing a more recent version of Node through your distribution's channels, you might want to consider using a third party package manager like Linuxbrew that installs stuff into your home directory, independent of the OS you're using.

Resources