I'm trying to get this example working.
Unfortunately I get this error when I run npm run build and I'm not sure what to do next.
> @ build /Users/oesdras/workspace/dachannel/app/apps/bstest
> bsb
20161117+dev -> 20161217+dev
Regenrating build spec
Unix.Unix_error(Unix.ENOENT, "execvp", "ninja")
child_process.js:511
throw err;
^
Error: Command failed: /Users/oesdras/workspace/dachannel/app/apps/bstest/node_modules/bs-platform/bin/bsb.exe
at checkExecSyncError (child_process.js:488:13)
at Object.execFileSync (child_process.js:508:13)
at Object.<anonymous> (/Users/oesdras/workspace/dachannel/app/apps/bstest/node_modules/bs-platform/bin/bsb:6:15)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.2.0/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v7.2.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! @ build: `bsb`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ build script 'bsb'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bsb
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
here are my files:
// package.json
{
"dependencies": {
"bs-platform": "1.4.0"
},
"scripts" : {
"build" : "bsb",
"watch" : "bsb -w"
}
}
// bsconfig.json
{
"name" : "helo",
"sources" : { "dir" : "src"}
}
(* src/fib.ml *)
let fib n =
let rec aux n a b =
if n = 0 then a
else
aux (n - 1) b (a+b)
in aux n 1 1
(* src/main_entry.ml *)
let () =
for i = 0 to 10 do
Js.log (Fib.fib i) (1)
done
# lib/bs/build.ninja
ninja_required_version = 1.7.1
bs_package_flags = -bs-package-name helo
src_root_dir = /Users/oesdras/workspace/dachannel/app/apps/bstest
bsc = /Users/oesdras/workspace/dachannel/app/apps/bstest/node_modules/bs-platform/bin/bsc.exe
bsdep = /Users/oesdras/workspace/dachannel/app/apps/bstest/node_modules/bs-platform/bin/bsb_helper.exe
ocamllex = ocamllex.opt
bsc_includes = -I src
bsc_flags =
ppx_flags =
bs_package_includes =
refmt = refmt
rule build_ast_and_deps
command = ${bsc} ${pp_flags} ${ppx_flags} ${bsc_flags} -c -o ${out} -bs-syntax-only -bs-binary-ast ${in}
description = Building ${out}
build src/fib.mlast : build_ast_and_deps $src_root_dir/src/fib.ml
rule build_deps
command = ${bsdep} -bs-bin-MD ${in}
description = Building ${out}
build src/fib.mlast.d : build_deps src/fib.mlast
rule build_cmj_only
command = ${bsc} ${bs_package_flags} -bs-no-builtin-ppx-ml -bs-no-implicit-include ${bs_package_includes} ${bsc_includes} ${bsc_flags} -o ${in} -c ${in} ${postbuild}
depfile = ${in}.d
description = Building ${out}
build src/fib.cmj $src_root_dir/lib/js/src/fib.js src/fib.cmi : build_cmj_only src/fib.mlast
bs_package_flags = $bs_package_flags -bs-package-output commonjs:lib/js/src
build src/main_entry.mlast : build_ast_and_deps $src_root_dir/src/main_entry.ml
build src/main_entry.mlast.d : build_deps src/main_entry.mlast
build src/main_entry.cmj $src_root_dir/lib/js/src/main_entry.js src/main_entry.cmi : build_cmj_only src/main_entry.mlast
bs_package_flags = $bs_package_flags -bs-package-output commonjs:lib/js/src
build build.ninja : phony || src/main_entry.mlast.d src/fib.mlast.d
you need install ninja 1.7 or newer
Try brew update && brew install ninja if you are on mac
Cool, it worked. Thank you very much.
Unfortunately I got another error. This time it seems to be related to Ocaml itself, any ideas? The files are the same I posted before.
ps. Not sure if this is the best place to ask for help, I'm just reusing the issue, hope you don't mind. Feel free to close the issue and point me to another channel.
> @ build /Users/oesdras/workspace/dachannel/app/apps/bstest
> bsb
ninja: Entering directory `lib/bs'
[4/4] Building src/main_entry.mlast.d
[2/2] Building src/main_entry.cmj /Users/oesdras/workspace/dachannel/app/apps/bstest/lib/js/src/main_entry.js src/main_entry.cmi
FAILED: src/main_entry.cmj /Users/oesdras/workspace/dachannel/app/apps/bstest/lib/js/src/main_entry.js src/main_entry.cmi
/Users/oesdras/workspace/dachannel/app/apps/bstest/node_modules/bs-platform/bin/bsc.exe -bs-package-name helo -bs-package-output commonjs:lib/js/src -bs-no-builtin-ppx-ml -bs-no-implicit-include -I src -o src/main_entry.mlast -c src/main_entry.mlast
File "/Users/oesdras/workspace/dachannel/app/apps/bstest/src/main_entry.ml", line 3, characters 4-10:
Error: This function has type 'a -> unit
It is applied to too many arguments; maybe you forgot a `;'.
ninja: build stopped: subcommand failed.
child_process.js:511
throw err;
^
Error: Command failed: /Users/oesdras/workspace/dachannel/app/apps/bstest/node_modules/bs-platform/bin/bsb.exe
at checkExecSyncError (child_process.js:488:13)
at Object.execFileSync (child_process.js:508:13)
at Object.<anonymous> (/Users/oesdras/workspace/dachannel/app/apps/bstest/node_modules/bs-platform/bin/bsb:6:15)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.2.0/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v7.2.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! @ build: `bsb`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ build script 'bsb'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bsb
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/oesdras/workspace/dachannel/app/apps/bstest/npm-debug.log
ah,
let () =
for i = 0 to 10 do
Js.log (Fib.fib i)
done
not
let () =
for i = 0 to 10 do
Js.log (Fib.fib i) (1)
done
btw, enjoy bsb -w watch mode
Works like a charm!
I copied the example and forgot to get rid of that (1).
bsb -w is awesome!
Thank you very much for your help and congratulations; bucklescript is awesome.
Gonna re-open this. This occurs quite often in Discord.
I'll make it better in the doc revamp. cc @rickyvetter
For note, you could set some css on the (1) and such parts to make the text in them unselectable, no worry about copy/pasting then even while selecting past them.
Done in new docs
Most helpful comment
Done in new docs