0

How do I initialize NPM with bash?

I'm really new to all that, I have never used npm before and I recently learned some really basic stuff about command lines and shells such as cmd, powershell and bash. I had started learning some basic commands of bash and today I wanted to figure out how NPC works and install a JavaScript package, but I cannot use init to npm with powershell or bash, it only works with cmd, I searched online but I couldn't find anything useful, I either found unrelated stuff or really complicated stuff for me to understand.

2nd Mar 2021, 9:42 AM
Karak10
Karak10 - avatar
10 Réponses
+ 2
@Karak10 First of all, you need Node on your Ubuntu. You can get Node easily with NVM(Node version manager) 1. Install NVM $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash 2. Install Node LTS version $ nvm install --lts If you don't have curl, download it first $ sudo apt-get install curl (It will ask for your unix password) The dollar signs($) are used to indicate terminal prompt. Don't type that.
3rd Mar 2021, 11:53 AM
Ore
Ore - avatar
+ 1
do you have nodejs and npm installed ?
2nd Mar 2021, 9:52 AM
Abhay
Abhay - avatar
0
`npm init` works with bash if you have Node and npm installed.
2nd Mar 2021, 10:14 AM
Ore
Ore - avatar
0
Ore whenever I try to use a npm command it throws an error saying npm command wasn't found
2nd Mar 2021, 2:48 PM
Karak10
Karak10 - avatar
0
I'm not using Linux, I'm using windows10 and have downloaded bash.
2nd Mar 2021, 2:49 PM
Karak10
Karak10 - avatar
0
Slick I will try it later when I have access to my laptop and see if it works
2nd Mar 2021, 2:51 PM
Karak10
Karak10 - avatar
0
@Karak10 What do you mean by you downloaded bash? Are you talking about Git Bash or WSL?
2nd Mar 2021, 2:52 PM
Ore
Ore - avatar
0
Ore WSL
2nd Mar 2021, 3:54 PM
Karak10
Karak10 - avatar
0
@Slick every time I try to use a command, like npm -v for example, the following error appears: not foundram Files/nodejs/npm: 3: /mnt/c/Program Files/nodejs/npm: : not foundram Files/nodejs/npm: 5: /mnt/c/Program Files/nodejs/npm: /mnt/c/Program Files/nodejs/npm: 6: /mnt/c/Program Files/nodejs/npm: Syntax error: word unexpected (expecting "in") I'm on windows 10 not Linux, and I'm using bash on Ubuntu.
3rd Mar 2021, 12:38 AM
Karak10
Karak10 - avatar