JohnCoene / packer

webpack + npm + R = ❤️
https://packer.john-coene.com/
Other
147 stars 6 forks source link

npm_install() not working on windows #5

Closed benjaminschwetz closed 3 years ago

benjaminschwetz commented 4 years ago

Hi, I tried to use packer on windows and noticed that the npm_* example doesn't really work.

packer::npm_install("sass", scope = "dev")
#> i Installing sass with scope devx Failed to install sass

I spotted that, for windows, it should probably be where instead of which in npm_find(), but I didn't have time to really look into it further.

packer:::npm_find()
#> Error in system2("which", "npm", stdout = TRUE): '"which"' not found
npm_find <- function () 
{
  npm <- getOption("JS4R_NPM", NULL)
  if (is.null(npm)) 
    npm <- suppressWarnings(system2("where", "npm", 
                                    stdout = TRUE))
  return(npm)
}
npm_find()
#> [1] "C:\\Program Files\\nodejs\\npm"     "C:\\Program Files\\nodejs\\npm.cmd"

Created on 2020-10-28 by the reprex package (v0.3.0)

JohnCoene commented 3 years ago

Hi Benjamin,

Sorry for getting to this so late. I've had a few hectic weeks, I pushed what I think should fix it.

Let me know if this does not work and I can take another look.

Thanks!