Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Karma failed

Tried to install Karma

npm install -g karma

A warning is produced

npm WARN optional dep failed, continuing [email protected]

At the end it seems there is no Karma installed

karma init karma.config.js
'karma' is not recognized as an internal or external command (so a windows installation).

However there seems to be a karma in

C:\Users\Me\AppData\Roaming\npm\node_modules\karma

and a builerror.log file

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (c:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:103:14)
gyp ERR! stack     at c:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:64:11
gyp ERR! stack     at Object.oncomplete (evalmachine.<anonymous>:108:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "c:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd  C:\Users\Me\AppData\Roaming\npm\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok 

Do I need to install python in order to work with karma or is something else wrong? Thanks in advance for any help!

like image 902
Gerard Avatar asked Feb 11 '23 23:02

Gerard


2 Answers

You need to install the command line interface so that karma will be recognised:

npm install -g karma-cli

Karma Installaltion Guide

The node-gyp error is because python isn't installed. To avoid that error follow the following steps:

  • Install python (v2.7.10 recommended, v3.x.x is not supported): http://www.python.org/getit/windows/
  • Make sure that you have a PYTHON environment variable, and it is set to drive:\path\to\python.exe not to a folder
  • Install Visual Studio

Windows XP/Vista/7: - Microsoft Visual Studio C++ 2013 (Express version works well) - If the install fails, try uninstalling any C++ 2010 x64&x86
Redistributable that you have installed first - If you get errors that the 64-bit compilers are not installed you may also need the compiler update for the Windows SDK 7.1

Windows 7/8: - Microsoft Visual Studio C++ 2013 for Windows Desktop (Express version works well)

Windows 10: - Install Visual Studio Community 2015 Edition. (Custom Install, Select Visual C++ during the installation) - Set the environment variable GYP_MSVS_VERSION=2015 - Run the command prompt as Administrator

If the above steps have not worked or you are unsure please visit http://www.serverpals.com/blog/building-using-node-gyp-with-visual-studio-express-2015-on-windows-10-pro-x64 for a full walkthrough

All Windows Versions - For 64-bit builds of node and native modules you will also need the Windows 7 64-bit SDK

You may need to run one of the following commands if your build complains about WindowsSDKDir not being set, and you are sure you have already installed the SDK:

call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x86
call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x64

Source: node-gyp Github

like image 116
Wayne Ellery Avatar answered Feb 13 '23 13:02

Wayne Ellery


Reference from https://stackoverflow.com/a/21366601/368997.
Karma requies node-gyp, and node-gyp has its own dependence (from the github). Especially Windows, you need python and make sure that you have a PYTHON environment variable.

like image 23
Chayapol Avatar answered Feb 13 '23 12:02

Chayapol