Unable to run lerna's command
Asked Answered
T

9

35

I am trying to install lerna using npm , packages are successfully added but when I run any command of lerna it comes out as.

bash: lerna: command not found

Node Version : v8.10.0

Npm Version : 3.10.9.

Here's what I am trying:

$ npm install --global lerna
C:\Users\<user-name>\AppData\Roaming\npm\lerna -> C:\Users\<user-name>\AppData\Roaming\npm\node_modules\lerna\bin\lerna.js
C:\Users\<user-name>\AppData\Roaming\npm
`[email protected]

VaibhavPC@Vaibhav MINGW64 ~/Projects/lerna init 
bash: lerna: command not found
Terbia answered 25/5, 2018 at 5:41 Comment(1)
You can check the below link , may it helps. #9588165Overburden
O
6

1) Check the ENVIRONMENT_VARIABLES that is NODE_PATH is present or not. If not, then have to append the path to PATH environment variable.

2) Re-install again

enter image description here

Overburden answered 25/5, 2018 at 9:30 Comment(0)
P
44

Try running the command

npm install --g lerna
Pavel answered 8/8, 2018 at 8:46 Comment(1)
How is this getting upvotes? You just repeated what the OP has already tried.Episcopal
P
21

Try to use npx lerna init it helped in my case

Perineum answered 8/1, 2020 at 8:25 Comment(0)
S
12

In my case, I just run sudo npm install --g lerna, and it works after bootstrap

Stiffler answered 18/6, 2019 at 19:11 Comment(0)
B
8

Three things:

  1. Please check environment, if the path is correctly setup or not, for command not found error.
  2. Second, you can go directly lerna folder and execute the command. If you are able to run from here that means problem is there in path ie point 1
  3. The third option is re-install and install it again.
Brilliantine answered 25/5, 2018 at 6:43 Comment(0)
O
6

1) Check the ENVIRONMENT_VARIABLES that is NODE_PATH is present or not. If not, then have to append the path to PATH environment variable.

2) Re-install again

enter image description here

Overburden answered 25/5, 2018 at 9:30 Comment(0)
C
6

just install the package globally

npm install --g lerna
yarn global add lerna
Curnin answered 11/4, 2021 at 20:8 Comment(0)
F
3

I faced this issue when I installed lerna using yarn. Reinstalling using npm solved the issue.

Faviolafavonian answered 25/5, 2018 at 5:55 Comment(1)
you just reinstall the npm and then run this command npm install --global lernaFaviolafavonian
J
1

I had this issue even with npm.

By explicitly adding

C:\Users\yourusername\AppData\Roaming\npm

to the PATH variable under System Variables in Environment Variables solves the issue for me.

Jacqulynjactation answered 12/2, 2019 at 20:47 Comment(0)
P
-5

Here's a repo you can try to learn lerna in a independent environment

Pontificate answered 5/6, 2018 at 2:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.