This repository has been archived by the owner. It is now read-only.

Windows installer doesn't ensure that $USERNAME\AppData\Roaming exists #8141

Open
othiym23 opened this Issue Aug 11, 2014 · 16 comments

Comments

Projects
None yet
@othiym23

othiym23 commented Aug 11, 2014

npm uses $APPDATA\npm so that non-Administrator roles have a writable place to stash global packages. Since creating that directory if it doesn't exist does require Administrator privileges, npm -g install <whatever> won't / can't work if the base directory doesn't exist (with the correct ACL) before npm is run. The installer should ensure that the whole path is set up at boot time.

Also, either the documentation needs to change, or maybe the installer, because right now, people trying to upgrade npm using npm after they've used the .msi frequently end up confused because npm -g install npm@latest doesn't actually upgrade them to the newest version of npm, because the first npm on their path is the one that was originally installed alongside node in the Administrator directory. Either the positions of AppData\roaming\npm and the Node binary directory need to be swapped in PATH, npm should be installed to AppData\roaming\npm in the first place, or the documentation should be clarified to tell Windows users exactly how to upgrade npm with the .msi-installed Node.

@ismyrnow

This comment has been minimized.

Show comment
Hide comment
@ismyrnow

ismyrnow Aug 25, 2014

I ran into this same issue doing an installation on Windows 8.1 x64 using node-v0.10.31-x64.msi. For installation, the workaround was to create the $USERNAME\AppData\Roaming\npm directory after installation.

ismyrnow commented Aug 25, 2014

I ran into this same issue doing an installation on Windows 8.1 x64 using node-v0.10.31-x64.msi. For installation, the workaround was to create the $USERNAME\AppData\Roaming\npm directory after installation.

@ciaranj

This comment has been minimized.

Show comment
Hide comment
@ciaranj

ciaranj Sep 9, 2014

This doesn't help with node.js application running as windows services though :/ As those user profiles are within c:\windows\system32...blah, convincing admins to add stuff in there is a challenge!

ciaranj commented Sep 9, 2014

This doesn't help with node.js application running as windows services though :/ As those user profiles are within c:\windows\system32...blah, convincing admins to add stuff in there is a challenge!

@tjfontaine

This comment has been minimized.

Show comment
Hide comment
@joshkpeterson

This comment has been minimized.

Show comment
Hide comment
@joshkpeterson

joshkpeterson Oct 18, 2014

The top voted answer in the SO thread did not fix for me, nor did running as admin. Once I installed something with the -g flag, the issue was fixed. Doing npm from then on worked as normal.

It's surprising to me that this bug has persisted for so long. Seems most folks installing on windows are getting tripped up.

joshkpeterson commented Oct 18, 2014

The top voted answer in the SO thread did not fix for me, nor did running as admin. Once I installed something with the -g flag, the issue was fixed. Doing npm from then on worked as normal.

It's surprising to me that this bug has persisted for so long. Seems most folks installing on windows are getting tripped up.

@xorcus

This comment has been minimized.

Show comment
Hide comment
@xorcus

xorcus Oct 20, 2014

should not be using $USERNAME\AppData\Roaming\npm
=> should be using $APPDATA\npm

xorcus commented Oct 20, 2014

should not be using $USERNAME\AppData\Roaming\npm
=> should be using $APPDATA\npm

@simonjosefsson

This comment has been minimized.

Show comment
Hide comment
@simonjosefsson

simonjosefsson Oct 30, 2014

+1, confirmed with v0.10.33-x86.msi

I installed node.js for the first time today.
Ran into this issue trying to follow a tutorial but found a solution on stackoverflow and then this issue.
Loving node.js so far but this is probably stopping some people from trying it out

simonjosefsson commented Oct 30, 2014

+1, confirmed with v0.10.33-x86.msi

I installed node.js for the first time today.
Ran into this issue trying to follow a tutorial but found a solution on stackoverflow and then this issue.
Loving node.js so far but this is probably stopping some people from trying it out

@othiym23

This comment has been minimized.

Show comment
Hide comment
@othiym23

othiym23 Oct 31, 2014

@xorcus That's actually what the prefix is set to, so I've updated my original comment to reflect that fact.

othiym23 commented Oct 31, 2014

@xorcus That's actually what the prefix is set to, so I've updated my original comment to reflect that fact.

@lukewatts

This comment has been minimized.

Show comment
Hide comment
@lukewatts

lukewatts Dec 5, 2014

So what is the solution/workaround for this until this is resolved? In lamens if possible. I'm a PHP dev who only uses Node for NPM so I'm really not into Node to be honest.

lukewatts commented Dec 5, 2014

So what is the solution/workaround for this until this is resolved? In lamens if possible. I'm a PHP dev who only uses Node for NPM so I'm really not into Node to be honest.

@xorcus

This comment has been minimized.

Show comment
Hide comment
@xorcus

xorcus Dec 5, 2014

@lukewatts I've installed node.js v0.10.33 yesterday on a Win8.1 and the problem seems to have been fixed - everything was working just fine

xorcus commented Dec 5, 2014

@lukewatts I've installed node.js v0.10.33 yesterday on a Win8.1 and the problem seems to have been fixed - everything was working just fine

@ianchanning

This comment has been minimized.

Show comment
Hide comment
@ianchanning

ianchanning Dec 5, 2014

@lukewatts as per comment from @ismyrnow, you need to create the npm directory. In layman's terms:

  1. Start > Run > %APPDATA%
  2. Create new folder npm

ianchanning commented Dec 5, 2014

@lukewatts as per comment from @ismyrnow, you need to create the npm directory. In layman's terms:

  1. Start > Run > %APPDATA%
  2. Create new folder npm

rockarts added a commit to rockarts/node that referenced this issue Dec 8, 2014

windows: Create npm folder in AppData directory
Create the empty npm folder in Roaming\Appdata so that
non-Administrator users have a place to store global packages.
This fixes the error Error: ENOENT, stat error that occurs
when a user tries to run the npm install <package> command.

Fixes #8141
@lukewatts

This comment has been minimized.

Show comment
Hide comment
@lukewatts

lukewatts Dec 9, 2014

@ianchanning Thanks. It actually turned out the install had simply set the wrong PATH ENVIRONMENT VARIABLE so anything trying to run it wasn't able. It had a trailing slash...once I removed that everything worked fine. Hope that helps someone.

lukewatts commented Dec 9, 2014

@ianchanning Thanks. It actually turned out the install had simply set the wrong PATH ENVIRONMENT VARIABLE so anything trying to run it wasn't able. It had a trailing slash...once I removed that everything worked fine. Hope that helps someone.

rockarts added a commit to rockarts/node that referenced this issue Dec 10, 2014

windows: Create npm folder in AppData directory
Create the empty npm folder in Roaming\Appdata so that
non-Administrator users have a place to store global packages.
This fixes the error Error: ENOENT, stat error that occurs
when a user tries to run the npm install <package> command.

Fixes #8141
@Michael-0

This comment has been minimized.

Show comment
Hide comment
@Michael-0

Michael-0 Dec 27, 2014

Just installed 10.35 x64 on Windows 8.1 and the issue is still there even with an admin command prompt. Just use the workaround from @ianchanning for now.

Michael-0 commented Dec 27, 2014

Just installed 10.35 x64 on Windows 8.1 and the issue is still there even with an admin command prompt. Just use the workaround from @ianchanning for now.

@Liam-Ryan

This comment has been minimized.

Show comment
Hide comment
@Liam-Ryan

Liam-Ryan Jan 7, 2015

Confirmed today as local Administrator on fresh install of server 2008 RC2. Created folder manually and ran elevated command prompt to work around it

Liam-Ryan commented Jan 7, 2015

Confirmed today as local Administrator on fresh install of server 2008 RC2. Created folder manually and ran elevated command prompt to work around it

piscisaureus added a commit to nodejs/node that referenced this issue Jan 12, 2015

win,msi: create npm folder in AppData directory
Create the empty npm folder in Roaming\Appdata so that non-Administrator
users have a place to store global packages. This fixes the error Error:
ENOENT, stat error that occurs when a user tries to run the npm install
<package> command.

Bug: nodejs/node-v0.x-archive#8141
PR: nodejs/node-v0.x-archive#8838
Reviewed-by: Bert Belder <bertbelder@gmail.com>

Please enter the commit message for your changes. Lines starting
@aliteralmind

This comment has been minimized.

Show comment
Hide comment
@aliteralmind

aliteralmind Feb 4, 2015

" I ran into this same issue doing an installation on Windows 8.1 x64 using node-v0.10.31-x64.msi. For installation, the workaround was to create the $USERNAME\AppData\Roaming\npm directory after installation." (link)

Same here.

"It actually turned out the install had simply set the wrong PATH ENVIRONMENT VARIABLE so anything trying to run it wasn't able. It had a trailing slash...once I removed that everything worked fine. Hope that helps someone." (link)

My path had C:\applications\programming\javascript\nodejs\. I changed it to C:\applications\programming\javascript\nodejs, relogged in, and it still didn't work.

aliteralmind commented Feb 4, 2015

" I ran into this same issue doing an installation on Windows 8.1 x64 using node-v0.10.31-x64.msi. For installation, the workaround was to create the $USERNAME\AppData\Roaming\npm directory after installation." (link)

Same here.

"It actually turned out the install had simply set the wrong PATH ENVIRONMENT VARIABLE so anything trying to run it wasn't able. It had a trailing slash...once I removed that everything worked fine. Hope that helps someone." (link)

My path had C:\applications\programming\javascript\nodejs\. I changed it to C:\applications\programming\javascript\nodejs, relogged in, and it still didn't work.

piscisaureus added a commit that referenced this issue Jul 1, 2015

win,msi: create npm folder in AppData directory
Create the empty npm folder in Roaming\Appdata so that non-Administrator
users have a place to store global packages. This fixes the error Error:
ENOENT, stat error that occurs when a user tries to run the npm install
<package> command.

Bug: #8141
PR: #8838
Reviewed-by: Bert Belder <bertbelder@gmail.com>

piscisaureus added a commit that referenced this issue Jul 1, 2015

win,msi: create npm folder in AppData directory
Create the empty npm folder in Roaming\Appdata so that non-Administrator
users have a place to store global packages. This fixes the error Error:
ENOENT, stat error that occurs when a user tries to run the npm install
<package> command.

Bug: #8141
PR: #8838
Reviewed-by: Bert Belder <bertbelder@gmail.com>
@BalaRavilla

This comment has been minimized.

Show comment
Hide comment
@BalaRavilla

BalaRavilla Jul 6, 2015

Try to find this .npmrc file in your user folder in c eg: C:\Users\baravill and make changes there as per the new instillation. Let me know if it works :)

BalaRavilla commented Jul 6, 2015

Try to find this .npmrc file in your user folder in c eg: C:\Users\baravill and make changes there as per the new instillation. Let me know if it works :)

misterdjules pushed a commit to misterdjules/node that referenced this issue Jul 16, 2015

Steven Rockarts Julien Gilli
win,msi: create npm folder in AppData directory
Create the empty npm folder in Roaming\Appdata so that non-Administrator
users have a place to store global packages. This fixes the error Error:
ENOENT, stat error that occurs when a user tries to run the npm install
<package> command.

Bug: nodejs#8141
PR: nodejs#8838
Reviewed-by: Bert Belder <bertbelder@gmail.com>
@teckjon

This comment has been minimized.

Show comment
Hide comment
@teckjon

teckjon Feb 1, 2016

I have followed https://github.com/npm/npm/wiki/Troubleshooting#error-enoent-stat-cusersuserappdataroamingnpm-on-windows-7 for windows 7 installation but I still keep getting error 1909. I have created the c/users//appdata/roaming/npm and appdata/npm as other users have suggested. The installer however keeps rolling back undoing it's installation the moment it hits error 1909.

teckjon commented Feb 1, 2016

I have followed https://github.com/npm/npm/wiki/Troubleshooting#error-enoent-stat-cusersuserappdataroamingnpm-on-windows-7 for windows 7 installation but I still keep getting error 1909. I have created the c/users//appdata/roaming/npm and appdata/npm as other users have suggested. The installer however keeps rolling back undoing it's installation the moment it hits error 1909.

jBarz added a commit to ibmruntimes/node that referenced this issue Nov 4, 2016

win,msi: create npm folder in AppData directory
Create the empty npm folder in Roaming\Appdata so that non-Administrator
users have a place to store global packages. This fixes the error Error:
ENOENT, stat error that occurs when a user tries to run the npm install
<package> command.

Bug: nodejs#8141
PR: nodejs#8838
Reviewed-by: Bert Belder <bertbelder@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.