How can I open react-devtools? - reactjs

I am trying to install and run react-devtools. I am following this guide to do that: https://github.com/facebook/react-devtools/blob/master/packages/react-devtools/README.md
The install seems to go ok:
To verify it installed correctly I do this command:
And I go to that directory and verify there is a folder called react-devtools.
To open the tools the docs indicate I should do this:
Back in my project directory I run this command:
And it says command not found. So it looks like I have installed the devtools, but I am unable to open them. What am I doing wrong?

Maybe this is what you want
Fix not run react-devtools
Option 1:
npm uninstall -g react-devtools
npm uninstall -g electron
npm install -g --verbose react-devtools
Option 2: (Fix in Linux, MacOSX)
sudo npm install -g react-devtools --unsafe-perm=true
Refer: react-devtools-command-not-found

if you want to run project level only do the following steps
Install using yarn add --dev react-devtools
Run yarn run react-devtools

To run react-devtools you can run either of the following commands depending on your package manager.
If using yarn:
yarn run react-devtools
If using npm:
npm run react-devtools

The real problem here is you are not giving "super user" permissions for the node package manager for installing the "react-devtools" globally.
Try this command it will fix your problem
sudo npm install -g react-devtools
When ignore the -g parameter in the command npm will install the react-devtools in directory that you currently working in. In your case the home directory.

Related

zsh: command not found: netlify on mac OS

I am trying to deploy basic react-app to netlify. I ran these commands to install and deploy application
npm install netlify-cli -g
netlify deploy
It throws:
zsh: command not found: netlify error.
I am working on mac OS. What is causing this issue?
It basically means your zshrc does not have npm binary directory in the PATH. Make sure that you have that squared away.
Are you using brew or nvm to install npm?
Correction
You have to install netlify-cli as well. That gives you the netlify command.
npm install -g netlify-cli
Go to folder:
/Users/<user>/.npm-global/lib/node_modules/
And delete any files/folders pertaining to Netlify. For exmaple folder named:
netlify-cli
Then reinstall the cli using
npm install netlify-cli -g
try this:
step 1: re-run the netlify-cli installation command to get the path where cli is installed
step 2: test the version using the full path where the cli is installed, it'll confirm that netlify-cli is working
step 3: add the npm directory link to your zsh environment variable PATH
Use the main Terminal(not the integrated terminal of your text editor) when installing the netlify-cli.
npm install -g netlify-cli
I had installed it multiple times in the integrated terminal of VS code but all in vain.Success came after using the Terminal.

How to fix: Npx create-react-app does not install everything only package.json and node modules

I'm trying to create a new react app, but whenever I do npx create-react-app or npm init react-app, only the node_modules and a portion of package.json is installed.
npx create-react-app new-app
(https://imgur.com/iJDVQ3E) -> Current package.json and folder structure
Expected public folder and script run commands in package.json
I know it's been two months, but I came across this exact issue and found the next solution:
You only need to update your npm and node modules, they are outdated for us or missing something important and that is why we get no template folders. Try below command:
run npm install -g update-node
run npm update npm -g
These two commands should fix it, if not, let me know, maybe I forgot one command to tell you.
Uninstall react in case its installed globally by running the command "npm uninstall -g create-react-app". then run "npx install -g create-react-app".
npx comes with npm 52+ updated versions
tried using the above 2 commands and got created all the required folders under react app.
run npm install -g update-node
run npm update npm -g

create-react-app command not found in ubuntu 16.04 LTS

I tried to install create react app using sudo npm install -g create-react-app on my terminal, then this message appeared:
/home/mahi/.npm-global/bin/create-react-app -> /home/mahi/.npm-global/lib/node_modules/create-react-app/index.js
+ create-react-app#1.4.3
updated 1 package in 11.7s
Then when I am going to run the command create-react-app hello-world, it says create-react-app command not found. Then I searched for many solutions, I tried almost all of them, but nothing improved, showing the command not found again and again.
I had this same problem and this is how I solved it.
It will work on Ubuntu 16.04 as well as Ubuntu 18.04.
First, open up terminal and run this command:
sudo npm install -g -y create-react-app
After that, you will be able to use the create-react-app anywhere on your machine because it is saved globally.
Are u sure to run npm install with sudo? I had same problem and terminal couldn't write to folder with commands. Does your /usr/local/lib/node_modules/ folder contains create-react-app?
are you using create-react-app with sudo? because if you installed the package using sudo npm install create-react-app then it is installed for this user, try sudo create-react-app and if it works then you should change ownership to your user
I use to have the same problem in the terminal when i write npm install -g create-react-app and them create-react-app my-first-app.
So i went react doc and i find npx create-react-app my-first-app that worked for me.
Hope that will help.
If you read carefully then you will see after installing Yarn it tells you to add the following thing in your path.
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
~/.yarn/bin is for yarn binaries only.
Try it!
Source: https://github.com/yarnpkg/yarn/issues/5156

Command not found returned in terminal on almost every line

I'm trying to work with AngularJS but I can't even get pass installing it via Terminal.
I enter this onto the command line
npm install -g #angular/cli
I get this as a result
- bash: npm: command not found
I seem to be getting this same error log on almost every command, the rest return nothing
I'm stumped as to why it's not working.
For reference I'm using OS X 10.9.5
Make sure you got node installed which comes with npm
https://nodejs.org/en/
You error looks like you don't even have node installed on your computer, first of all, you need to install node js on you computer, once you’ve installed Node.js, you can make sure you’ve got the very most recent version of npm using npm itself: sudo npm install npm -g.
Then you can continue your installation with the step below:
To install #angular/cli locally run npm install #angular/cli --save, while to install it globally run npm install -g #angular/cli.
But if it requires a root access, then you have to include the sudo which will then be sudo npm install -g #angular/cli.
I figured it out. I needed to adjust the .bash_profile by entering this
echo "export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/b‌​in" >> ~/.bash_profile
Thanks to everyone who gave advice :)

Install Angular CLI on Google Cloud Shell

I'm trying to install the #angular/cli npm package inside of the Google Cloud Shell. When I run npm install -g #angular/cli the package manager does through and starts trying to perform the install and then fails with a permissions issue.
Error: EACCES: permission denied, access '/usr/local/nvm/versions/node/v6.9.2/lib/node_modules'
I've tried to run this with sudo npm install -g #angular/cli but the terminal tells me:
NPM: command not found"
I tried to perform the installation to my $HOME instead, using this gist, but accessing the ~/.bashrc file is denied.
What am I supposed to do in order to install global node packages like this?
Try
$ sudo -i npm install -g #angular/cli

Resources