react native is not set up after setting up the PATH variable - shell

I am setting up react native on mac. I have installed node along with npm.
node version is v6.11.4
npm version is 5.4.2
I have install react native, command shown on the below image. And also export the PATH, then also it shows an error that react-native command not found. Could anyone help?
After running npm install -g react-native --verbose, it shows following:

I believe the command to get react-native-cli version is react-native -version which will show CLI version and the version of any react-native project directory you are in

I've seen this very error happening to a colleague of mine back in India. For some reason their ISP restricted the network to a level they couldn't access the NPM registry fully and the only way around it at that time was to use a VPN. Sadly I can't provide you any more info as this happened a couple of years ago.
You may want to change your DNS settings to override your ISPs' to see whether this helps but the reason why installation of react-native-cli is failing is that you can't access the NPM registry so it's a problem with your network provider rather than your machine.

Related

How Do I Solve "Trufle Init 'command not found'" Terminal Issue on Mac?

I'm trying to set up the tools needed to develop a decentralised application.
I would need to input truffle init to my terminal as part of the process. I've tried multiple times to solve the "command not found" message I keep getting when I input truffle init, but I have not found a solution. I'm not sure if there are any other ways I could bypass this issue. It seems as though a lot of the developer tools I've tried to install for blockchain development have been difficult to install or integrate with my Mac.
Thank you for any assistance provided.
Have you tried to install truffle globally?
sudo npm install -g truffle#latest
Please verify that you have installed truffle properly using
truffle -version

Firebase command not found days after having already successfully used it

I am trying to use the 'firebase' command from my Mac terminal to deploy firebase cloud functions using 'firebase deploy --only functions'. I just used this command a week or two ago when I updated my firebase-functions and firebase-tools to version 3.18.4 but now everytime I try to use the 'firebase' keyword to run a command it says -bash: firebase: command not found. When I run npm -g list I see that I have firebase, firebase-tools and more in that list.
I've tried running 'npm install -g firebase-tools` but it still doesn't work. Also I tried what is recommended in this question
but still not working. Any advice would be great, thanks
First I ran npm get prefix which should output something like /Users/username/.npm-packages. Then I had to add the following to my $PATH variable
export PATH="/Users/username/.npm-packages/bin:$PATH"
Note the extra /bin (after the result of npm get prefix)
And I also added
export PATH="/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:~/bin:$PATH$
Then you must activate the changes to your bash_profile by running source ~/.bash_profile
Once I did this the firebase command is again globally recognized
Try the following in your terminal:
curl -sL https://firebase.tools | bash
This will check the OS of your machine and then install everything else automatically and properly.
The command is from the official Firebase Documentation.
I've just fallen into the same issue. My case was in different node versions a) when installing firebase globally, b) when using it during next session. I'm using nvm and my default was node v10, but I installed firebase on node v12. So after restart I got node v10. When I realised it, I switched nvm default from v10 to v12:
$ nvm alias default v12.13.1
And firebase started working.
For those who use yarn instead of npm to manage global packages, yarn seems to place binaries in isolated directory as symbolic links.
In my case, I did yarn bin to look for where binaries are, turned out it is $HOME/.config/yarn/global/node_modules/.bin. So, I set it to .bashrc. Now it's working.

Installed trigger app, installed node.js, trigger says it can't run npm on Mac

New Mac user account. I install the Trigger.io (TriggerToolkit) app for the Mac. It fires up a tab with the apps. I can run the iOS simulator from it - so it is plausibly working installation. I have installed node.js from the node.js website, using the Mac package.
I have node.js as /usr/local/bin/npm (version 1.1.43).
It is found when I type "npm" at a command line.
The path "/usr/local/bin" is on my $PATH.
"/usr/local/bin" is set in my /etc/paths file, system wide.
So the npm executable should be findable by any user, at any time (before or after login, running a terminal, etc).
When I use the web page for the web run, it's OK, until it tries to run npm.
[DEBUG] running run_web((), {})
[DEBUG] Running: npm install
[DEBUG] failed to run npm: do you have Node.js installed and on your path? while running run_web((), {})
[ERROR] failed to run npm: do you have Node.js installed and on your path?
I guess that the problem must be something to do with an assumption about the path for npm. What's the assumption? What can I symlink to make this work?
Note that npm is found by "forge run web". This is something specific to the way that TriggerToolkit.app is working.
Update: this is fixed as of v1.4.6:
http://docs.trigger.io/en/v1.4/release-notes.html#v1-4-6
Previous answer:
Unfortunately I think the error message here isn't great and reflects a general problem with starting the node app.
We are aware of one issue with dependencies which started occurring after Node 0.8. Can you check what Node version you have:
node --version
If it's 0.8, then a temporary workaround to this problem is to use the command line tools and:
forge build
Then manually update development/web/package.json to refer to express 2.5.10, then
forge run web
Sorry for the trouble, we'll report back here when that's fixed

Installing packages in native windows node.js

I am trying to get to grips with node.js, this looked like a fun tut http://net.tutsplus.com/tutorials/javascript-ajax/how-to-scrape-web-pages-with-node-js-and-jquery/ but I have only got the native windows version of node.js and I can't find a way to install any packages.
I have also looked at installing the binaries using chocalatey, but my version of vista doesn't have access to powershell. However, I do have a machine running windows 7 that I can switch to. If it isn't possible to install packages on windows version, I will switch to that machine and work through chocalatey.
Assuming you have the node.exe for Windows, npm has experimental support for windows. You can try working through the README.
Otherwise you can manually install packages on Windows. You will need to manually look at the package.json files for dependencies if you are going with option 2.
I have never tried it, but Scott Hanselman also has a post about getting node running on Windows.
Personally I have found its easier to just run a Linux VM since Windows support is kinda spotty right now.
The short answer is if you have git properly installed, you can open a cmd window, navigate to the directory containing node.exe, and run this:
git config --system http.sslcainfo /bin/curl-ca-bundle.crt
git clone --recursive git://github.com/isaacs/npm.git
cd npm
node cli.js install npm -gf
The more complete answer is that I posted a guide on how to install Node on Windows here. It also describes installing npm to manage packages. Let me know if it works for you.

Node.js + Socket.io + Windows 7 / 8?

I've been searching everywhere, but can't seem to find a solution. Is it possible to install Socket.io on Node.js on Windows 7?
If not, is there some sort of alternative, or do you know of any future Windows support?
Usually the Node.js package manager is used, however I can't find a way of installing that on Windows. http://npmjs.org/
I'm currently using Node.exe (not running it through Cygwin).
This is how I'd imagine it would be installed on Windows, if NPM worked:
npm install socket.io
Node Package Manager now works on Windows 7
Simply install Node.js and type npm install socket.io into the Windows console and look in C:\Users\[insert username]\node_modules.
I am confirming that npm install socket.io works perfectly with Node.js 0.6.10 on Windows 7 (remember to run cmd as Administrator).
For anyone who is having trouble getting Node.js and socket.io working on Windows...
There is the nodejs-win project on Google Code.
http://code.google.com/p/nodejs-win/downloads/detail?name=node_setup_0.5.6.7.exe&can=2&q=
And here is a video that shows the basics of using it.
Node.JS & Socket.IO Chat System in Windows
Now that Node.js version 0.6.0 is available, and it seems pretty stable so far, I'm going to suggest using it if you're planning on developing on Windows.
http://nodejs.org/download/
Either use a Linux box or git clone the socket.io repository and require it from a local path.
You will have to copy the entire socket.io library into, for example, lib/socket.io/
Then var io = require("./lib/socket.io/index.js
npm runs on Node.js. If you are having problems running npm, then you should also be having problems with Node.js. Assuming you are running Node.js through Cygwin, then you should be able to run
node npm install socket.io
(Which is the same as npm install socket.io)
Also.
Npm is just the Node.js package manager. There is nothing that it provides that you can't get from the repositories themselves. It is just, for obvious reasons, a lot easier to use npm.
If you want the socket.io included, then just create a node_modules directory inside of your /lib directory or wherever your project is, and then clone the socket.io to it.
https://github.com/LearnBoost/socket.io
Edit
The OP indicated that he is using node.exe. There is no way currently as of 1st September 2011 to use npm with node.exe. It is currently on the node.exe roadmap and will hopefully be completed soon, but not as of today.
(Check the mailing list if you want to be updated).
Since the 0.6.6 version (as far as I remember) Node.js has a normal version for Windows, and after installing it a npm.exe file appears in the install directory, not sure how exactly I was running it, maybe something like node npm install socket.io.
Or maybe npm install socket.io. If none of these works, try to execute npm by typing full path to it (unless you have added a system variable for the path). For the record - I have successfully installed sokcet.io on Windows 7 via npm :)
Until NPM is built for Windows you'll need to download the packages manually and create the node_modules folder structure in the node.exe folder. Follow this post.
For me, downloading the modules directly from GitHub and putting them in the "node_modules" directory works. AFAIK that's what npm does. It works both if you put it in your user directory, or in the same directory as node.exe.
Too bad there's no Windows port for npm, since there's almost no porting needed to be done, and that node comes as a stand-alone executable instead of an installer, like Python.
I faced the same problem and edited the Socket.IO library to work on windows. Details of the same you can find here.
I had the same problem with Node.js v10.22 on Windows 7 - this worked for me:
npm install socket.io#0.8.4
Create a file called package.json in your project directory with the following.
{
"name": "project name",
"description": "project description,
"version": "0.0.1",
"dependencies": {
"express": "2.4.6",
"socket.io": "version"
}
}
Then run the npm install

Resources