1
First of all, any mistake with npm
distributed via repositories always confirm that it is not lacking to update the program, your problem may be with Node, it may be with npm can be with Ubuntu, see if everything is updated with fixes (I’m not talking about updgrade, only update even), to summarize the command is:
sudo apt-get update
On the terminal, check the version of Node and npm used with the commands:
node -v
npm -v
I believe that at this point (05/28/2019), even in linux environments the version of Node.js has to be 10.x, NPM has to be 6.9.x (I don’t know what the situation is, maybe edit the answer)
The command line interface expo-cli
shall be installed globally (flag -g
)
Now about the expo-cli
, it is a package to apply a command line interface, I really believe you don’t even need to run it with sudo
, since the intention is to use in the current user and not in root
(I could be wrong), just turn this:
npm install -g expo-cli
Okay, I would have installed for the your user current the expo
, to check if it worked type in the terminal:
expo --help
You don’t even need to edit the file ~/.profile
to make the command "global" because it runs under the npm
(I believe, correct me if I’m wrong)
Good answer. + 1 :) However, I find it wrong to state that "command line interfaces should be installed globally", since this is not always the case.
– Luiz Felipe
Dear @Luizfelipe and how you want to run a dynamic CLI (like expo-cli, express-cli, http-server cli, Ionic/cli, Gulp) does not run "globally"? Do you have an example of CLI that can be limited to the project folder? Maybe create a
.bat
(or a bash) in the folder alone? I’ve never really heard of anything like this, but I would be grateful for your criticism and pointing ;)– Guilherme Nascimento
In a
npm script
, for example. When you install a package which provides a "binary", it is solved when executed by the NPM script. In this sense, something I do a lot is to install the Eslint CLI locally per project, using a scriptlint
defined aseslint .
to lint my files. So, I don’t need to install globally and I leave it to project. An example here.– Luiz Felipe
I understand your placement Luiz, but there the interface is the NPM itself, the command itself is not global, these are commands of the
devDependencies
generally and not in fact "interfaces", but as I see it, I will change the text to be more clear on this later, I have not thought about how to write :)– Guilherme Nascimento
Yes! But they are still CLI’s, only instead of being installed globally, they are installed by the project. Nothing prevents you from installing as well
dependencies
...– Luiz Felipe
@Luizfelipe I think this is to go too far and mix with "semantics" to explain things technically XD ... better let see another way to explain, because I really believe that there is the npm that makes a call from something inside, but rest assured that today even edit ;)
– Guilherme Nascimento
Yes. :v Underneath the covers is the NPM calling the same command...
– Luiz Felipe
@Luizfelipe edited the answer to state only about the exclusive use of
expo-cli
... ps: yes, almost everything underneath is NPM, just like in Composer, everything underneath is php+bat+phar, which does not preclude understanding in the end being how it works and not what was used to develop such a tool, but as I have said, it is my opinion :)– Guilherme Nascimento