nodejs - New-Item creating a file instead of a folder
See original GitHub issueHi,
I’ve had a problem recently with a personal NodeJS DockerFile inspired from yours. I installed bower globally but it started failing some time ago, complaining about “bower” not being a known command.
Long story short, I fixed it by modifying the path creation line :
New-Item -path $env:APPDATA -Name 'npm' -itemType "directory"
instead of
New-Item $($env:APPDATA + '\npm')
I’ve added a test command to the Dockerfile :
RUN dir C:\Users\ContainerAdministrator\AppData\Roaming\npm
which confirms that npm was a 0-length file.
Am I the first to notice this error ? Honestly I don’t understand how or why bower started not working… I have proof the same lines just worked 6 months ago, maybe with an older npm version. I can do a pull request if you confirm it needs fixing.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
See PR #249, it’s been a month but I’ve finally found some time to do it !
I assume that global npm packages are installed in the nodejs directory if the current user has the permissions to do it, or AppData if it does not. The documentation isn’t exactly helpful on this subject…
By the way I think I found where my errors really come from : randomly, npm or bower just won’t install the required packages. I suppose it’s linked to my random DNS problems, those commands might just fail silently when name resolution goes awry, and I was misled by the npm folder misunderstanding.
Thanks for your time, I’ll submit a PR to simplify the npm path management.