Node on Windows--problems

It tends to be a little flaky. After several failures I decided to make a clean install. I removed nodjs using Control Panel. But that's not enough.

Npm keeps two directories around that you need to clean up manually:
      C:\Users\<username>\AppData\Roaming\node-cache has stuff that has been downloaded from the repository and not installed. Clearing it fixed some of my problems. And nuking       C:\Users\<username>\AppData\Roaming\node_modules cleaned the rest.



When I tried to do a clean install I ran into s a bug in the Windows installer right now that yields an error that looks like this:
npm ERR! Error: spawn ENOTSUP
npm ERR! at errnoException (child_process.js:483:11)
npm ERR! at ChildProcess.spawn (child_process.js:446:11)
npm ERR! at Object.spawn (child_process.js:342:9)
npm ERR! at spawn (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\
exec.js:118:22)

Blah, blah, blah (as described in issue 2405):
The solution is in this commit. You'll need to edit the npm source file found here:
C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils


Then make this change:



@@ -106,8 +105,8 @@ function spawn (c, a, env, takeOver, cwd, uid, gid) {
106105
              , cwd : cwd || null }
107106
     , cp
108107
109
-  if (!isNaN(uid)) opts.uid = +uid
110
-  if (!isNaN(gid)) opts.gid = +gid
108
+  if (uid && !isNaN(uid)) opts.uid = +uid
109
+  if (gid && !isNaN(gid)) opts.gid = +gid



Unless you are running your editor with administrative privileges you'll have to modify the file's permissions to save the change. I did it with explorer's properties dialog.


I tried to install all my packages locally rather than globally to avoid any cross-contamination, even at the cost of space. That didn't work for brunch, which seems to create a brunch.cmd only when installed globally.



Comments

Popular Posts