Error with npx create-react-app in Ubuntu - node.js

I have an issue trying to run npx create-react-app, this is the output:
You are running Node 8.10.0.
Create React App requires Node 10 or higher.
Please update your version of Node.
I tried to install and uninstall nodejs, the version that I have is v8.10.0, that's what I got running sudo apt install nodejs
Am I missing something?

For me, this worked
sudo npm cache clean -f
sudo npm install -g n
sudo n stable

You can update your node version using npm which gets installed with NodeJS.
first clear the npm cache:
npm cache clean -f
then Install n, Node’s version manager:
npm install -g n
and at last, use: n [version.number] or n stable in your CLI.

Related

Can't Upgrade Ionic Version on Ubuntu

I'm trying to update my Ionic Cli from 6.12.2 to the latest version (6.19.0). I'm using Ubuntu. I was able to update node.js to the latest version, but when I run the commands:
npm uninstall -g ionic
npm uninstall -g #ionic/cli
with or without sudo command, when I run ionic -v again, it still say that I have the version 6.12.2 of ionic. and when I run npm install -g #ionic/cli and then run ionic -v it still say the same. Those commands are not being able to remove ionic from my Ubuntu.
That is something like a cache folder on ubunt that I should delete from system, related with the ionic cli, or something like that? Because I was not able to do this following the documentation on website.
To work around the problem, you can install the latest version from tarball:
cd /tmp
wget https://registry.npmjs.org/#ionic/cli/-/cli-6.19.0.tgz
sudo npm -g install cli-6.19.0.tgz

Angular CLI don't create project and require the npm#6

When I execute ng new first-project it returns that:
npm version detected. The Angular CLI temporarily requires npm version 6 while upstream issues are addressed.
Please install a compatible version to proceed (`npm install --global npm#6`).
For additional information and alternative workarounds, please see https://github.com/angular/angular-cli/issues/19957#issuecomment-775407654
All right, I already have backed to npm#6 and no resolve, always show that message. Also, I already have cleaned the cache but I cannot resolve.
I'm using Ubuntu
The Angular CLI version is 11
I had the same problem on Ubuntu 20.10. Here are the steps I executed to resolve the problem:
Install nvm:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Install node using nvm:
nvm install node
Install angular/cli:
npm install -g #angular/cli
Install npm#6:
npm install --global npm#6
Clear cache:
npm cache clean --force
Create the new app:
ng new first-project

to install npm bluetooth-hci-socket in project repository

all I'm going to develop a BLE Desktop app by using node, Electron Js as well as bleno. for this, we need "npm bluetooth-hci-socket" but I am facing some issues to installing this npm library into my project repo.
Install node version manager:
sudo npm install -g n
Downgrade node to v 8.9.0 by:
sudo n 8.9.0
and
sudo npm install bluetooth-hci-socket --unsafe-perm
Looks like you're missing the install verb in your command. It should be:
npm install bluetooth-hci-socket

Install angular on mac

I'm trying to install Angular on macOS. I have npm 5.6.0 and node 8.11.1 installed. I tried sudo npm install -g #angular/cli, which seems to install it. However, when I type ng --version, I get:
Unknown error: ReferenceError: Invalid left-hand side in assignment
Edit: I also tried this, to no effect:
npm uninstall -g angular-cli
npm cache clean or npm cache verify (if npm > 5)
npm install -g #angular/cli#latest
You can use the macOS package manager. In your terminal type:
brew install angular-cli
To confirm your version:
ng --version
I think the best way to install angular on mac is using brew.
1.) Install brew, by typing the following command on your terminal :-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2.) After Installing brew, then run following command :-
brew install angular-cli
After Installation, you'll see angular is successfully installed.
To check, Type Command :-
ng version
Delete npm and node, then install them via brew (works perfect on mac os).
See https://brew.sh/

Start with fresh copy of node, npm and cordova

I had a makeshift setup on Lubuntu that 'functioned' with sudo npm install. I used Ionic Framework generator to create projects and they functioned as well as the builds and deployment.
I upgraded to 15.04 and ever since had problems finding a solution that worked does not give EACCESS errors or grunt serve telling me
Upgrade warning - for the CLI to run correctly,
it is highly suggested to upgrade the following:
Please update your Node runtime to version >=0.12.x
Please update your Cordova CLI to version >=4.2.0 npm install -g cordova
then for npm install -g cordova to tell me
npm WARN engine cordova-serve#0.1.3: wanted: {"node":">= 0.12.0","npm":">= 2.5.1"} (current: {"node":"0.10.26","npm":"2.12.1"})
I have tried the "chown -R whoami /dir/of/npm"
I have delete npm, node install brew and created new installs for all.
I still get EACCESS errors, my yo ionic "grunt serve" deploys the browser but gives ERR_CONNECTION_REFUSED
I installed brew, manually deleted the npm folder and did a clean install. No joy
which node - /home/username/.nvm/v0.10.26/bin/node
node -v v0.10.26
which npm - /home/userna/.linuxbrew/bin/npm
npm -v 2.12.1
which cordova - /usr/local/bin/cordova
cordova -v 3.5.0-0.2.6
And for good meassure i thought if i installed node4 all my troubles would disappear.
I know i messed this up but i would like a clean start with node, npm(without sudo) and cordova. Any help would be appreciated
Ps: I have done most of the normal suggestions hence my question.
Did you installed node using nvm?
So try
nvm use 4.0.0
In general:
nvm install [VERSION]
nvm use [VERSION]
To use permanent:
nvm alias default [VERSION]
try also to install cordova again after updating node
npm install -g cordova
If all fails:
Uninstall node and reinstall propper using brew:
cd ~
sudo rm -rf .npm
brew update
brew uninstall npm
brew install npm

Resources