File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -60,18 +60,29 @@ node_init <- function(npm_command) {
60
60
61
61
# Run the specified command in Node.js directory (assume it already exists).
62
62
node_run <- function (command , ... , background = FALSE ) {
63
- args <- list (
64
- command = command ,
65
- args = rlang :: chr(... ),
63
+ if (.Platform $ OS.type == " windows" ) {
64
+ # Workaround: {processx} cannot find `npm` on Windows, but it works with a shell.
65
+ call_args <- list (
66
+ command = " cmd" ,
67
+ args = rlang :: chr(" /c" , command , ... )
68
+ )
69
+ } else {
70
+ call_args <- list (
71
+ command = command ,
72
+ args = rlang :: chr(... )
73
+ )
74
+ }
75
+ call_args <- c(
76
+ call_args ,
66
77
wd = node_path(),
67
78
stdin = NULL ,
68
79
stdout = " " ,
69
80
stderr = " "
70
81
)
71
82
if (background ) {
72
- do.call(processx :: process $ new , args )
83
+ do.call(processx :: process $ new , call_args )
73
84
} else {
74
- do.call(processx :: run , args )
85
+ do.call(processx :: run , call_args )
75
86
invisible ()
76
87
}
77
88
}
You can’t perform that action at this time.
0 commit comments