Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows is not recognizing serverless as internal or external command

I wanted to install serverless in my windows 7 machine.My npm version is 6.1.0. I used the command

npm install -g serverless
C:\Users\ADMIN\AppData\Roaming\npm\serverless -> C:\Users\ADMIN\AppData\Roaming\npm\node_modules\serverless\bin\serverless
C:\Users\ADMIN\AppData\Roaming\npm\slss -> C:\Users\ADMIN\AppData\Roaming\npm\node_modules\serverless\bin\serverless
C:\Users\ADMIN\AppData\Roaming\npm\sls -> C:\Users\ADMIN\AppData\Roaming\npm\node_modules\serverless\bin\serverless

> [email protected] postinstall C:\Users\ADMIN\AppData\Roaming\npm\node_modules\serverless\node_modules\spawn-sync
> node postinstall


> [email protected] postinstall C:\Users\ADMIN\AppData\Roaming\npm\node_modules\serverless
> node ./scripts/postinstall.js

+ [email protected]
added 351 packages from 269 contributors in 154.064s

But when I type serverless in command prompt, it tells me

'serverless' is not recognized as an internal or external command,
operable program or batch file.
like image 761
Subhendu Mahanta Avatar asked Mar 06 '23 14:03

Subhendu Mahanta


1 Answers

I had the same issue and I believe you are missing the npm path from your environment variables.

Go to Windows search and type: "Edit the system environment variables" (at least this is how you can find the Environment Variables in Windows 10).

Go to Advanced tab and click on Environment Variables.

Select Path from the User Variables and click Edit.

Click New and provide the following: C:\Users[USER_NAME]\AppData\Roaming\npm\ or whatever is the path that you have installed npm - just change the [USER_NAME] with your username account.

Else you could navigate to the path above and execute "serverless" from inside that path.

Hope that helps :)

like image 135
spiros Avatar answered Mar 08 '23 04:03

spiros