ReasonML example app repos - most don't work


I wonder why ResasonML apps published on github mostly don’t work (many of them say run “npm install” and “npm start” but all I see is an empty page).

I’m sure there are multiple REasons why. Some of them I throw a compile error, some of them seem to be building fine but still not working. I’m happy to share a more detailed report of the various projects I’ve tried and symptoms.

It’s a bit discouraging as a newbie when you want to see something running and hack on it, and it’s already not working from the getgo. Is there anything the Reason community could do to improve the likelihood that example projects will be in a working state (or perhaps troubleshooting guide, etc.) and give newbies a better experience?


You may need to update the devDependencies. Most of the time for me it’s bs-platform not being the same version as my global installed version


Ok thanks, I’m not sure what is the recommended way to update devDependencies, but I did yarn upgrade and it seemed to work. Then I got a weird error about bs-platform was not installed (I thought I had it?) . I installed it again. Then I got further and finally got stuck again with this error:

Error: syntactic function type is not allowed when working with abstract bs.deriving, create a named type as work around
[8/14] Building src/ReasonReact.mliast.d[9/14] Building src/ReasonReactOptimizedCreateClass.mlast.d[10/14] Building src/ReactDOMServerRe.mlast.d[11/14] Building src/ReactEventRe.mlast.d[12/14] Building src/ReasonReact.mlast.d[13/14] Building src/ReactEventRe.mliast.d
ninja: error: rebuilding '': subcommand failed

That doesn’t seem to give me any line of project code that I can investigate (I’m currently looking at 2048-reasons).


By reading the error message, it seems you have an old bs-platform.
"Error: syntactic function type is not allowed when working with abstract bs.deriving, create a named type as work around"
This restriction is lifted in newer version of bs-platform


Understood, but like I said above, I did yarn upgrade and installed bs-platform (via reason-cli@3.2.0-darwin, hopefully this would install latest version?).

In any case, I think we need more robust handling of different platforms and the upgrade process. There should be a simple set of steps to upgrade a project that one can take to get a project in a working state (unless code changes are required, in which case the error messages should be a little more helpful!)

I looks like I have this version:
bsc -v
The OCaml compiler, version BuckleScript 2.2.2 (Using OCaml4.02.3+BS )
Standard library directory: /usr/local/lib/node_modules/bs-platform/lib/ocaml

This looks like it’s old. I can’t find documentation on how to upgrade bs-platform, how do I upgrade?


Also, I wonder why not include “you may need a newer version of bs-platform” in error messages like above. Or better yet, include a link to how to upgrade bs-platform!


You can simply update bs-platform via npm e.g. npm i -g bs-platform


Thanks. Ok, I ran the this npm command. First it said “Please try running this command again as root/Administrator.” So I did sudo npm i -g bs-platform but I I still got errors. This is the debug log output:

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’,
1 verbose cli ‘/usr/local/bin/npm’,
1 verbose cli ‘i’,
1 verbose cli ‘-g’,
1 verbose cli ‘bs-platform’ ]
2 info using npm@5.6.0
3 info using node@v8.9.4
4 verbose npm-session 6b3130627e5ded62
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 11ms (from cache)
8 silly pacote tag manifest for bs-platform@latest fetched in 30ms
9 silly install loadIdealTree
10 silly install cloneCurrentTreeToIdealTree
11 silly install loadShrinkwrap
12 silly install loadAllDepsIntoIdealTree
13 silly resolveWithNewModule bs-platform@4.0.0 checking installable status
14 silly currentTree lib
14 silly currentTree └── bs-platform@2.2.2
15 silly idealTree lib
15 silly idealTree └── bs-platform@4.0.0
16 silly install generateActionsToTake
17 silly diffTrees action count 1
18 silly diffTrees update bs-platform@4.0.0
19 silly decomposeActions action count 10
20 silly decomposeActions unbuild bs-platform@2.2.2
21 silly decomposeActions remove bs-platform@2.2.2
22 silly decomposeActions fetch bs-platform@4.0.0
23 silly decomposeActions extract bs-platform@4.0.0
24 silly decomposeActions preinstall bs-platform@4.0.0
25 silly decomposeActions build bs-platform@4.0.0
26 silly decomposeActions install bs-platform@4.0.0
27 silly decomposeActions postinstall bs-platform@4.0.0
28 silly decomposeActions finalize bs-platform@4.0.0
29 silly decomposeActions refresh-package-json bs-platform@4.0.0
30 silly install executeActions
31 silly doSerial global-install 10
32 verbose correctMkdir /Users/ottovonwachter/.npm/_locks correctMkdir not in flight; initializing
33 verbose lock using /Users/ottovonwachter/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
34 silly doParallel extract 10
35 silly extract bs-platform@4.0.0
36 silly doReverseSerial unbuild 10
37 silly unbuild bs-platform@2.2.2
38 info lifecycle bs-platform@2.2.2~preuninstall: bs-platform@2.2.2
39 info lifecycle bs-platform@2.2.2~uninstall: bs-platform@2.2.2
40 verbose unbuild rmStuff bs-platform@2.2.2 from /usr/local/lib/node_modules
41 silly isEverInside /usr/local/bin/bsc is not inside /usr/local/lib/node_modules/bs-platform
42 silly gentlyRm parent.path = /usr/local/lib/node_modules/bs-platform
43 silly gentlyRm parent.managed = /usr/local/lib/node_modules/bs-platform is in /usr/local
44 silly gentlyRm target.path = /usr/local/bin/bsc
45 silly gentlyRm target.symlink = …/lib/node_modules/bs-platform/lib/bsc
46 silly gentlyRm target.managed = /usr/local/bin/bsc is in /usr/local
47 silly gentlyRm target.inParent = { target: ‘/usr/local/lib/node_modules/bs-platform/lib/bsc’,
47 silly gentlyRm path: ‘/usr/local/lib/node_modules/bs-platform’ }
48 silly isEverInside /usr/local/bin/bsb is not inside /usr/local/lib/node_modules/bs-platform
49 silly gentlyRm parent.path = /usr/local/lib/node_modules/bs-platform
50 silly gentlyRm parent.managed = /usr/local/lib/node_modules/bs-platform is in /usr/local
51 silly gentlyRm target.path = /usr/local/bin/bsb
52 silly gentlyRm target.symlink = …/lib/node_modules/bs-platform/lib/bsb
53 silly gentlyRm target.managed = /usr/local/bin/bsb is in /usr/local
54 silly gentlyRm target.inParent = { target: ‘/usr/local/lib/node_modules/bs-platform/lib/bsb’,
54 silly gentlyRm path: ‘/usr/local/lib/node_modules/bs-platform’ }
55 silly isEverInside /usr/local/bin/bsrefmt is not inside /usr/local/lib/node_modules/bs-platform
56 silly gentlyRm parent.path = /usr/local/lib/node_modules/bs-platform
57 silly gentlyRm parent.managed = /usr/local/lib/node_modules/bs-platform is in /usr/local
58 silly gentlyRm target.path = /usr/local/bin/bsrefmt
59 silly gentlyRm target.symlink = …/lib/node_modules/bs-platform/lib/bsrefmt
60 silly gentlyRm target.managed = /usr/local/bin/bsrefmt is in /usr/local
61 silly gentlyRm target.inParent = { target: ‘/usr/local/lib/node_modules/bs-platform/lib/bsrefmt’,
61 silly gentlyRm path: ‘/usr/local/lib/node_modules/bs-platform’ }
62 info lifecycle bs-platform@2.2.2~postuninstall: bs-platform@2.2.2
63 silly doSerial remove 10
64 silly remove /usr/local/lib/node_modules/bs-platform
65 silly doSerial move 10
66 silly doSerial finalize 10
67 silly finalize /usr/local/lib/node_modules/bs-platform
68 silly doParallel refresh-package-json 10
69 silly refresh-package-json /usr/local/lib/node_modules/bs-platform
70 silly doParallel preinstall 10
71 silly preinstall bs-platform@4.0.0
72 info lifecycle bs-platform@4.0.0~preinstall: bs-platform@4.0.0
73 silly doSerial build 10
74 silly build bs-platform@4.0.0
75 info linkStuff bs-platform@4.0.0
76 silly linkStuff bs-platform@4.0.0 has /usr/local/lib/node_modules as its parent node_modules
77 silly linkStuff bs-platform@4.0.0 is part of a global install
78 silly linkStuff bs-platform@4.0.0 is installed into a global node_modules
79 silly linkStuff bs-platform@4.0.0 is installed into the top-level global node_modules
80 verbose linkBins bs-platform@4.0.0
81 verbose linkBins [ { bsb: ‘lib/bsb’, bsc: ‘lib/bsc’, bsrefmt: ‘lib/bsrefmt’ },
81 verbose linkBins ‘/usr/local/bin’,
81 verbose linkBins true ]
82 verbose linkMans bs-platform@4.0.0
83 silly linkBins Converting line endings of hashbang file: /usr/local/lib/node_modules/bs-platform/lib/bsc
84 silly linkBins Converting line endings of hashbang file: /usr/local/lib/node_modules/bs-platform/lib/bsb
85 silly linkBins Converting line endings of hashbang file: /usr/local/lib/node_modules/bs-platform/lib/bsrefmt
86 silly doSerial global-link 10
87 silly doParallel update-linked 10
88 silly doSerial install 10
89 silly install bs-platform@4.0.0
90 info lifecycle bs-platform@4.0.0~install: bs-platform@4.0.0
91 silly doSerial postinstall 10
92 silly postinstall bs-platform@4.0.0
93 info lifecycle bs-platform@4.0.0~postinstall: bs-platform@4.0.0
94 verbose lifecycle bs-platform@4.0.0~postinstall: unsafe-perm in lifecycle false
95 verbose lifecycle bs-platform@4.0.0~postinstall: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/local/lib/node_modules/bs-platform/node_modules/.bin:/usr/local/lib/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
96 verbose lifecycle bs-platform@4.0.0~postinstall: CWD: /usr/local/lib/node_modules/bs-platform
97 silly lifecycle bs-platform@4.0.0~postinstall: Args: [ ‘-c’, ‘node scripts/install.js’ ]
98 silly lifecycle bs-platform@4.0.0~postinstall: Returned: code: 1 signal: null
99 info lifecycle bs-platform@4.0.0~postinstall: Failed to exec postinstall script
100 verbose unlock done using /Users/ottovonwachter/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
101 verbose stack Error: bs-platform@4.0.0 postinstall: node scripts/install.js
101 verbose stack Exit status 1
101 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
101 verbose stack at emitTwo (events.js:126:13)
101 verbose stack at EventEmitter.emit (events.js:214:7)
101 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
101 verbose stack at emitTwo (events.js:126:13)
101 verbose stack at ChildProcess.emit (events.js:214:7)
101 verbose stack at maybeClose (internal/child_process.js:925:16)
101 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
102 verbose pkgid bs-platform@4.0.0
103 verbose cwd /Users/ottovonwachter/code/2048-reasons
104 verbose Darwin 17.2.0
105 verbose argv “/usr/local/bin/node” “/usr/local/bin/npm” “i” “-g” "bs-platform"
106 verbose node v8.9.4
107 verbose npm v5.6.0
108 error code ELIFECYCLE
109 error errno 1
110 error bs-platform@4.0.0 postinstall: node scripts/install.js
110 error Exit status 1
111 error Failed at the bs-platform@4.0.0 postinstall script.
111 error This is probably not a problem with npm. There is likely additional logging output above.
112 verbose exit [ 1, true ]


It’s an permission error. See this