Friday 4 April 2014

Failed to replace env in config: ${APPDATA}

Phonegap installation using "npm" throws error on Windows7

Failed to replace env in config: ${APPDATA}

Solution:

Edit file "npmrc" located at:
C:\nodejs\node_modules\npm
Replace the following line:
prefix=${APPDATA}\npm
with
prefix=C:\nodejs\node_modules\npm\npm
Save the file and run the command again:
C:\ npm install -g phonegap
It will now install phonegap successfully :)

After that - another important step is to update PATH variable of system environment, otherwise, when you run below command:
phonegap create my-app
You will run into error - phonegap command not recognised.
To avoid this error, edit PATH with following value:
C:\nodejs\node_modules\npm\npm
If nothing works fine, then close the command prompt and open new one. 
First verify correct path value and then run phonegap command.
=======================
Source: https://github.com/npm/npm/issues/2840

5 comments: