3
votes

I have created frontend angular 8 project with nodejs version 10.16.0 and cli version 8.1.2

but I have to install backend nodejs project which only support node version 8 then for running this backend project I have install NVM and changed my current node version(10.16.0) to 8.10.0.

After changing node version my backend project running properly.

but now I can not run any angular 8 project.and got error

"You are running version v8.10.0 of Node.js, which is not supported by Angular CLI 8.0+. The official Node.js version that is supported is 10.9 or greater."

for resolving this issue I have uninstall CLI and install again but project not running.

At same time I have tried to run angular 5 project but this was also not running and got same error. For angular 5 project I have install angular cli 1.7.0 localy but still got same error.

To remove cli version i have use command:

npm uninstall --save-dev angular-cli
npm cache clean --force
npm install @angular/[email protected] --save

How can I run angular 8 and angular 5 frontend with nodejs version 8.10.0 at same time?

1
First, Angular doesn't run on NodeJS. The Angular CLI does. Second, the solution is in the question: use NVM to install several versions of Node, and use the appropriate one based on what you're doing: 10.x for your Angular CLI tools, and 8.x to run your NodeJS backend. - JB Nizet
Please read my question first. I have already used NVM. if angular does not affect on nodejs version then why I have got error while try to run my angular project i.e "You are running version v8.10.0 of Node.js, which is not supported by Angular CLI 8.0+. The official Node.js version that is supported is 10.9 or greater." - Prashant Shukla
Because what you're running is the Angular CLI: ng serve is an Angular CLI tool that starts a web server runnng on NodeJS and that buids your app. The app itself runs inside the browser. I have read your question. Have you read my comment? You have nvm, so use it to use the appropriate version of Node based on what you're doing. That's the whole point of NVM. - JB Nizet
Dear JB, I can understand you want to say that angular run on cli not on nodejs. but ultimatly cli run on nodejs. am i right? well if using nvm i have change node version then i can not run my nodejs project. how can i run both project simultaniusly? - Prashant Shukla
I told you twice already that Angular runs in the browser, not on NodeJS. And that it's Angular CLI that runs on Node JS. I never said anywhere that "angular run on cli". You imagined that. Read the documentation of nvm. If you change the version in one shell, used to run the Angular CLI, that doesn't affect the version used in another shell, used to run your NodeJS server. Again, that's the whole point of NVM. - JB Nizet

1 Answers

4
votes

I have also faced the same issue, I have installed both the version using NVM.

Set Nodejs version 10.16.0 as default version.

nvm alias default node 10.16.0

Open a new terminal window

nvm use 8.10.0

Same is Working for me :)

Note: Only thing is when you close and open terminal it'll change to the default version.