Open chenglou opened 7 years ago
Hello Windows user!
First. A very warm welcome. We're really glad you are here! We've been waiting for you! And I bring you good news:
working
workaround by running Merlin on Windows 10 WSLnpm install bsansouci/bsb-native\#2.1.1
C:/somewhere/xxx
, etc). But project dependencies, tools are linux based and should be installed/built/used on WSL (not Windows Command Prompt). Editing can be done on Windows as usual. Basically, instead of using Windows Command Prompt, you'll be using WSL's Bash.wslconfig /list /all
lxrun /uninstall /full
wslconfig /setdefault Ubuntu
wslconfig /unregister Ubuntu
sudo apt-get update
sudo apt-get dist-upgrade
Pick between Manual vs Automated option:
npm install -g ocaml-reason-wsl
npm uninstall -g ocaml-reason-wsl
bash -ci
is required for executing any application from WSL in Windows Command Prompt.
On WSL (not Windows Command Prompt):
node -v
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo export PATH=~\/.npm-global\/bin:\$PATH >> ~/.bashrc
source ~/.bashrc
npm install -g npm
# Important!Pick a method "OPAM" or "Reason-CLI". And run commands on WSL:
npm install -g reason-cli@3.2.0-linux
sudo apt-get install -y build-essential
sudo apt-get install -y ocaml-nox opam m4
opam init
echo eval \$\(opam config env\) >> ~/.bashrc
opam update
opam switch 4.02.3
eval $(opam config env)
opam update
opam install reason
opam install merlin.2.5.4
# For Windows, Merlin 2.5.4 is stable and recommended.npm install -g bs-platform
"editor.formatOnSave": true
"reason.diagnostics.tools": ["merlin", "bsb"]
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe"
C:\projects\
cd /mnt/c/projects/
bsb -init demoapp -theme basic-reason
cd demoapp
npm install
npm run start
C:\projects\demoapp
64-bit
.bsb
(like bsb -make-world
) generates .merlin
file. bsb
has to be executed in WSL to create .merlin file with unix path style (instead of Windows style path).bash -ci 'ocamlmerlin -version'
The Merlin toolkit version 2.5.4, for Ocaml 4.02.3
ocamlmerlin -version
The Merlin toolkit version 2.5.4, for Ocaml 4.02.3
ocaml-reason-wsl
over Windows's NPM first, make sure to remove it.
npm -g uninstall ocaml-reason-wsl
wslconfig /list /all
wslconfig /setdefault Ubuntu
lxrun /uninstall /full
C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\
Report it. Come to Discord. Tweet. Spread the word. Show your friends how awesome you are for having the cutting edge Reason working in Windows. Your love is appreciated. S2
This is a development
post for keeping notes, tracking issues to when time is due improve official user guide post above. It has been split to lower the noise.
Notes:
How it would work
refmt
, it is possible to use bsrefmt
that comes with bs-platform, under node_modules/bs-platform/bin/bsrefmt
. This is BuckleScript's vendor refmt, pinned at 1.13.7 (for the new syntax3, it's node_modules/bs-platform/bin/refmt3.exe
. Just make your editor point to it."reason.path.refmt": "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\bs-platform\\lib\\refmt3.exe",
For now, solution for "Windows Native" isn't ready. Because:
ReasonML's VSCode extension requires Merlin for working. Which leads to the case where either Merlin works on Windows (with windows paths in .merlin file) or Merlin has to be disabled. It's absence is not handled gracefully and shows errors. In a future release Merlin might be optional. Right now on Windows native neither can be done. (Having it working nor disable it.)
Workaround to using windows native without Merlin and getting rid of Merlin errors in VSCode extension: Setting ocamlmerlin-server
to ocamlmerlin
app name in VSCode config. It doesn't pop up any errors anywhere. But won't work (autocompletion, code lens, diagnostics) either. But it requires having ocamlmerlin-server
(could be installed from Cygwin ENV).
Still on Research. Attempts:
If you know how to make this documentation better, reply here, shout at us or just fix it (if you can). Thanks in advance for helping us make this documentation better.
Join effort! :) https://github.com/facebook/reason/issues/1698
reference to npm install -g reason-cli@3.1.0-linux
should be updated to npm install -g reason-cli@3.2.0-linux
hey,
I am using Reason on Windows 10 (WSL) and I followed the instructions here - at least I think so but I get this error
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'start' ]
2 info using npm@5.6.0
3 info using node@v8.11.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle demoapp@0.1.0~prestart: demoapp@0.1.0
6 info lifecycle demoapp@0.1.0~start: demoapp@0.1.0
7 verbose lifecycle demoapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle demoapp@0.1.0~start: PATH:...
9 verbose lifecycle demoapp@0.1.0~start: CWD: reason-test/demoapp
10 silly lifecycle demoapp@0.1.0~start: Args: [ '-c', 'bsb -make-world -w' ]
11 silly lifecycle demoapp@0.1.0~start: Returned: code: 2 signal: null
12 info lifecycle demoapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: demoapp@0.1.0 start: `bsb -make-world -w`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid demoapp@0.1.0
15 verbose cwd /reason-test/demoapp
16 verbose Linux 4.4.0-17134-Microsoft
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "start"
18 verbose node v8.11.3
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 2
22 error demoapp@0.1.0 start: `bsb -make-world -w`
22 error Exit status 2
23 error Failed at the demoapp@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
Intersting enough I have 2 other machines where this worked w/o problems. Does anybody see the error?
None of this seems to be needed for Windows.
Just tried on Windows 10:
yarn global add bs-platform
bsb -init my-react-app -theme react
cd my-react-app
yarn install
yarn start
In another command prompt:
yarn run webpack
In vscode pressed control+p and pasted the command:
ext install jaredly.reason-vscode
Looks like it works as it should (did reload the vscode window after installing and setting Reason_language_server values in settings)
ocaml 4.02.3 is severly outdated and I require ocaml 4.05 or greater. Is there a known solution to get merlin to work with WSL and VSCode with Ocaml >= 4.05 ? If yes, how? Simply switching to a newer ocaml version does not work.
I got it running with installing X-Windows and running VSCode on WSL. However you better have a powerful machine. It ain't exactly fast
That does not seem much better than just using a Unix-VM. Both, X-Windows and a VM are not enjoyable on my laptop though
@amsterdamharu as the project grows, jaredly.reason-vscode
extension will eventually fail with "Command line is too long": https://github.com/jaredly/reason-language-server/issues/262
See the post below. If you have new findings, please comment. We'll then integrate your findings into the post and remove the comment to reduce noise. Thanks!
Edit: upon demand, I've cleaned up most of the outdated replies.