34

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
`--lerna@2.11.0

VaibhavPC@Vaibhav MINGW64 ~/Projects/lerna init 
bash: lerna: command not found
Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
Vaibhav Agrawal
  • 714
  • 2
  • 6
  • 10
  • 1
    You can check the below link , may it helps. https://stackoverflow.com/questions/9587665/nodejs-cannot-find-installed-module-on-windows – Praveen Kumar May 25 '18 at 05:44

9 Answers9

43

Try running the command

npm install --g lerna
Alper Ebicoglu
  • 8,884
  • 1
  • 49
  • 55
20

Try to use npx lerna init it helped in my case

Ales Pazniak
  • 201
  • 2
  • 3
12

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

Ping Woo
  • 1,423
  • 15
  • 21
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.
Narendar Singh Saini
  • 3,555
  • 1
  • 17
  • 17
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

Praveen Kumar
  • 1,966
  • 1
  • 9
  • 16
5

just install the package globally

npm install --g lerna
yarn global add lerna
Ericgit
  • 6,089
  • 2
  • 42
  • 53
3

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

Mandar Dhadve
  • 371
  • 2
  • 12
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.

mruanova
  • 6,351
  • 6
  • 37
  • 55
-5

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