2

I am trying to install npm so I can install less. I just went to the node.js website and installed node. however, when i type npm in the command prompt i get the error:

Error: Failed to replace env in config: ${APPDATA} at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:429:13 etc.

Any suggestions?

I think node installed because node -v yeilds v0.12.7

As3adTintin
  • 2,406
  • 12
  • 33
  • 59
  • I think your path might not be set up right. Try over here: http://stackoverflow.com/questions/27864040/fixing-npm-path-in-windows-8 – Zachary Dow Aug 18 '15 at 20:10
  • 1
    thanks @ZacharyDow for the hints. i followed that and then used this link that i had seen before https://github.com/npm/npm/issues/7468 – As3adTintin Aug 18 '15 at 20:39
  • No problem, so it's working for you with that fix? – Zachary Dow Aug 18 '15 at 20:40
  • @ZacharyDow I think so, it seems to work. when I typed `npm install -g less` some text appears. however it is not recognizing `lessc` as a command. is there a way to check? – As3adTintin Aug 18 '15 at 20:49
  • when i just type `npm`my cmd shows `Usabe: npm ` so that looks good i think – As3adTintin Aug 18 '15 at 20:50
  • Alright, shall I answer with the info from that link? – Zachary Dow Aug 18 '15 at 20:51
  • hmm maybe i'm still not confident that the npm install is functional – As3adTintin Aug 18 '15 at 21:02
  • Looks like you need to set up the NODE_PATH to get globally installed modules to work http://stackoverflow.com/a/9588052/2283050 Remember that you can always --save-dev to have them work for projects now without configuration. I have the same thing happening to me actually, but I use it just fine with my local stuff. – Zachary Dow Aug 18 '15 at 21:05
  • mm thanks for the insight. what's --save-dev? – As3adTintin Aug 18 '15 at 21:07
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/87313/discussion-between-zachary-dow-and-as3adtintin). – Zachary Dow Aug 18 '15 at 21:08

1 Answers1

2

You need to configure your 'AppData' environment variable.

https://github.com/npm/npm/issues/7468

I just created a environment variable called APPDATA with the value like this:

variable : APPDATA

value :C:\Users\my_user_name\AppData\Roaming\npm;npm

Zachary Dow
  • 1,897
  • 21
  • 36
  • As of Nov 2016, it appears the `npmrc` file appends the npm folder. The above value caused all kinds of folder problems. Setting APPDATA to just `c:\users\\AppData\Roaming` worked. And APPDATA should be a User (not system) environment variable – ExactaBox Nov 05 '16 at 19:44