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.
10 odpowiedzi
+ 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.
+ 1
do you have nodejs and npm installed ?
0
`npm init` works with bash if you have Node and npm installed.
0
Ore whenever I try to use a npm command it throws an error saying npm command wasn't found
0
I'm not using Linux, I'm using windows10 and have downloaded bash.
0
Slick I will try it later when I have access to my laptop and see if it works
0
@Karak10 What do you mean by you downloaded bash? Are you talking about Git Bash or WSL?
0
Ore WSL
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.