How to install gatsby? - node.js

When I try to install gatsby running npm install gatsby-cli -g , it shows that is successfuly installed but it does not work when I run gatsby --help oder gatsby -- build .... , it shows:
-bash: gatsby: command not found

the reason you are getting that is that you haven't installed it globally
$ npm i -g gatsby
$ source ~/.bashrc
source will refresh your terminal so you don't need to close it and open it up again
cli commands only work with globally installed packages

The Gatsby CLI is available via npm and should be installed globally by running:
npm install -g gatsby-cli
If you are unable to successfully run the Gatsby CLI due to a permissions issue, you may want to check out the npm docs on fixing permissions.

global flag -g comes first while installing any package
instead of npm install gatsby-cli -g run npm i -g gatsby-cli
any of below will work
npm install --global <package_name_to_install>
npm install -g <package_name_to_install>
npm i --global <package_name_to_install>
npm i -g <package_name_to_install>
for you package_name_to_install is gatsby-cli

Related

Npm always showing me npm ERR! when I try to install anything

Please I need your help whenever I try to install anything with npm I always get errors please help me.
Update
From what read from the docs you should install the #ionic/cli
$ npm install -g #ionic/cli
From the docs:
If there was a previous installation of the Ionic CLI, it will need to be uninstalled due to a change in package name.
$ npm uninstall -g ionic
$ npm install -g #ionic/cli
You may want to add debug info while installing e.g.:
$ npm install -dd -g #ionic/cli
From your screenshot not sure if there is an error with your GIT config, or permissions to install the ionic cli globally on your machine...
Outdated
There should not be a space between ionic and #4, you should run e.g.:
npm install -g ionic#4
You can try with command like this npm install -g ionic#{{version}}.
In the place of version you should put your prefered version.

No valid versions available for undefined when running npm install -g #angular/cli

Running Windows 10 Enterprise.
I am trying to install angular cli to run the angular project. I entered below command.
--> npm install -g #angular/cli
I m getting below error.
--> npm ERR! code ENOVERSIONS
--> npm ERR! No valid versions available for undefined
what am i doing wrong
Seems to be you have to uninstall the node version and have to install it again
In order to run the npm install -g #angular/cli You need to have the node installed. Please find the below link to install the relevent node version for your PC. And try running the npm install -g #angular/cli command again.
Download the Node.js
Please make sure old node_modules are completely deleted and package-lock.json . Try fresh npm install now
rm package-lock.json
rm -rf node_modules
npm install

Problems installing Vue js

I am trying to install vue.js with no success, yet npm is up to date.
When I run vue init webpack vueapp I get this error:
No command 'vue' found, did you mean:Command 'vpe' from package 'texlive-latex-extra' (universe)
vue: command not found
I have already installed the cli using npm install vue-cli.
Thanks
Try to use npm install -g #vue/cli and then vue ui to start client in your browser.
You'll want to use npm install -g #vue/cli. Restart your terminal to make sure it shows up.
Also, make sure you have node 8.9+
From the docs:
Warning regarding Previous Versions
The package name changed from vue-cli to #vue/cli. If you have the previous vue-cli (1.x or 2.x) package installed globally, you need to uninstall it first with npm uninstall vue-cli -g or yarn global remove vue-cli.
Node Version Requirement
Vue CLI requires Node.js version 8.9 or above (8.11.0+ recommended). You can manage multiple versions of Node on the same machine with nvm or nvm-windows.
For me sudo helps to solve it.
Try to use this command in terminal:
sudo yarn global add #vue/cli
Then you can check the version and all will work correctly.
vue --version
Have you installed view?
Can you check vue --version
https://cli.vuejs.org/guide/installation.html
Try to use sudo npm install -g #vue/cli instead of npm install -g #vue/cli
You need to use sudo.
The vue-cli documentation at https://cli.vuejs.org/guide/installation.html states that:
To install the new package, use one of the following commands. You
need administrator privileges to execute these unless npm was
installed on your system through a Node.js version manager (e.g. n or
nvm).
npm install -g #vue/cli
# OR
yarn global add #vue/cli
Just run npm install -g pnpm for the missing packages.
Then you can run npm install -g #vue/cli
Now you can ckeck the vue --version
sudo npm install -g #aws-amplify/cli --unsafe-perm=true
It works for my situation.

Warn when install Angular cli via npm in global scope

I’m using 9.6.1 version of node, it goes with 5.6.0 version of npm.
I’m trying to install Angular with follow command:
$ npm i --no-optional -g #angular/cli
But is returned the follow message: npm WARN sass-loader#6.0.6 requires a peer of node-sass#^4.0.0 but none is installed. You must install peer dependencies yourself.
I have installing node-sass like this:
$ npm i --no-optional -g node-sass#^4.0.0
And it installs well.
So I run $ npm i --no-optional -g #angular/cli again, but the warning continues.
If I installing without -g flag, everything happens well, but I need to install globally to use ng command.

Cannot install #angular/cli

I am trying to work on angular2 for which I have installed nodeJS. I have followed the steps given here https://github.com/angular/angular-cli#prerequisites but there seems to be an issue. Here's what I did in the Command Prompt(Admin):
C:\WINDOWS\system32>node -v
v6.10.1
C:\WINDOWS\system32>npm -v
3.10.10
C:\WINDOWS\system32>npm install -g #angular/cli
[ ..............] / loadRequestedDeps: sill install loadAllDepsIntoIdealTree
My command prompt is stuck at this command and shows no sign of response. I will be glad if there are any suggestions on solving this issue of mine. Is there anything I am missing here?
Make sure.,you already installed nodejs.
npm install -g angular-cli
ng help
ng new PROJECT_NAME
cd PROJECT_NAME
ng serve
ng serve --host 0.0.0.0 --port 4201 --live-reload-port 49153
This command solved this problem for me:
npm install -g rimraf
The TLS key was a real problem and also install windows-tools does not help. After rimraf and using the right proxy settings and node_modules destination I can install angular-cli.
Can you try from the users directory C:\Users\userName or PC name just as shown in the below figure, and make sure you're not limited to any network related issues !
https://s-media-cache-ak0.pinimg.com/originals/87/50/24/87502456dd8043729b794bf00ee2c7e7.jpg
Try this -
Global Package :
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
Local Package :
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev #angular/cli#latest
npm install
I faced the similar problem. Press Ctrl + C in the command Prompt. It will continue and it will not exit.
Run "npm install" inside this project folder to install all
dependencies.
Make sure you use the latest version of the CLI (upgrade guide
below)
Run "ng serve" to see the app in action.
Then,
Run the below commands to upgrade the latest version of the CLI - only use "sudo" on Mac/ Linux.
sudo npm uninstall -g angular-cli #angular/cli
sudo npm install -g #angular/cli
uninstall node.js
delete all node_modules from your directory
delete npm from AppData>Roaming>
delete npm_cache and all newly generated node files from the c:\users[username} directory.
install node.js
add local path as:
new>PATH>c:\users[username}\AppData\Roaming\npm
keep this before Temp path
in cmd: npm -v node -v C:\Users\693272>npm install -g #angular/cli
ng -v
(here 'ng' error should not come)
and now you can go to some other directory also and create your new project as
everything installed is set globally
C:\Users\693272>cd /
C:>d:
D:>ng new app1 -d
HOPE THIS HELPS!
Open PowerShell as admin:
Set-ExecutionPolicy RemoteSigned
npm cache clean --force
npm install -g npm#latest
npm config set registry http://registry.npmjs.org/
npm install -g #angular/cli --verbose
Start > Run > AppWiz.cpl > Uninstall node.js
Delete the node install directory removing remaining folders and files
Delete npm folder from Start > Run > %AppData% (AppData\Roaming)
If it exists delete npm-cache from the c:\users[username} directory
Install node.js the Latest Version and please use the default C:\Program Files\nodejs install path.
Open Cmd:
C:\Users\Jeremy>node -v
v17.1.0
C:\Users\Jeremy>npm -v
8.1.2

Resources