npm / npm

This repository is moving to: https://github.com/npm/cli
http://npm.community
17.53k stars 3.02k forks source link

Problems running bower from Network Service account #15464

Closed stibay closed 7 years ago

stibay commented 7 years ago

Not sure if this issue should be posted here or in the bower repo but it looks like it's an issue on how npm is installing bower for the Network Service account.

To open a cmd window for the network service account I am using PSTools with this line: psexec -i -u "nt authority\network service" cmd.exe

C:\>npm --v
3.10.10
C:\>node -v
v7.2.1
C:\>npm config get registry
https://registry.npmjs.org/

Windows Server 2008 R2

C:\>npm -g list
C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm
`-- bower@1.8.0
> C:\>npm install -g bower
> C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm\bower -> C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm\node_modules\bower\bin\bower
> C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm
> `-- bower@1.8.0
> C:\>bower
> 'bower' is not recognized as an internal or external command, operable program or batch file.

I have also tried adding C:\Program Files\nodejs\node_modules\bower\bin to the global PATH and restarting cmd

On a local account on the machine bower is working fine.

What I am noticing is that there is no bower files under C:\Program Files\nodejs (but in \node_modules there is a bower folder) Modules like gulp, karma, webpack is here and running any of those works fine.

legodude17 commented 7 years ago

What is the result of npm prefix -g? Is that dir in your $PATH?

stibay commented 7 years ago

Ah nice. That fixed it \o/

C:\>npm prefix -g
C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm

Added that path to the global path and installed bower with -g again.

Noticed that the path for npm prefix -g on my local account was already in the path for that user.