rhino
rhino copied to clipboard
`build_sass()` doesn't work with `watch = TRUE` on Windows
SO question with details
I can confirm that rhino::build_sass(watch = TRUE)
is encountering an error in Windows (full paths edited to relative paths).
> rhino::build_sass(watch = TRUE)
yarn run v1.22.19
$ sass --no-source-map --style=compressed root/app/styles/main.scss:root/app/static/css/app.min.css --watch
Sass is watching for changes. Press Ctrl-C to stop.
Unexpected exception:
Error: EPERM: operation not permitted, stat '~\test-rhino\.rhino\node\root'
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
Error: EPERM: operation not permitted, stat '~\test-rhino\.rhino\node\root'
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (~\test-rhino\.rhino\node\node_modules\chokidar\index.js:647:10)
at NodeFsHandler._addToNodeFs (~\test-rhino\.rhino\node\node_modules\chokidar\lib\nodefs-handler.js:645:18)
at async ~\test-rhino\.rhino\node\node_modules\chokidar\index.js:451:21
at async Promise.all (index 0) {
errno: -4048,
code: 'EPERM',
syscall: 'stat',
path: '~\\test-rhino\\.rhino\\node\\root'
}
Node.js v18.9.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error in `value[[3L]]()`:
! System command 'yarn' exited with status 1.
ℹ If you can't use Node.js and yarn, try using sass: 'r' configuration.
Run `rlang::last_error()` to see where the error occurred.
Rhino Diagnostics
> rhino::diagnostics()
Windows 10 x64 build 22621
R version 4.2.1 (2022-06-23 ucrt)
rhino: 1.1.1
node: v18.9.0
yarn: 1.22.19
@vibalre @kamilzyla
Ended up figuring this out after I figured out the rhino::build_js(). Node / yarn is looking for the index.js / app.main.css files, respectively, in a folder starting at root, inside the .rhino folder in your main directory where your app resides.
For the build_sass() function, you'll need to have a copy of this file app/static/css/app.min.css located in another folder
Same goes for the build_js() function, except you'll need to grab index.js from app/js and move a copy of that over to
If that doesn't work, you'll need to make sure you have windows developer mode on: https://consumer.huawei.com/en/support/content/en-us15594140/
If that doesn't do the trick, you may have a python version too high - I think node wants 3.10 or less. If not that, perhaps you need to redo your Visual Studio install. If so, you should uninstall all the other stuff, get Visual Studio, get python, then get Node.
Hope that helps anyone running into trouble for now.
@kamilzyla not 100% sure on this, but I kicked off a new rhino project and ran the build_sass() and it worked without having to move any files around. Perhaps after getting it to work once it's good to go thereafter?
@AdrianAntico The root cause of the problem is our .rhino/node/root
symbolic link (an implementation detail), as described in #372. We are going to fix it with #375.
In this case rhino::build_sass()
works (assuming the root
link was correctly created, i.e. Developer Mode was enabled when Node.js was installed), but rhino::build_sass(watch = TRUE)
doesn't. It seems that symbolic links are just not well supported on Windows yet.