I just tried the basic Hello World examples and I noticed:
The “installation” section suggests to install the platform globally.
The scaffolded project has the platform as a local dependency.
I see that the “bs-platform” folder takes up 1GB of space. So here I just “lost” 2GB of my hard drive.
I understand that the package may be large, but it’s pretty wasteful on space having several projects with local install.
PS. Just tried to uninstall the local package and run “build”. Got an error (I am on Mac):
~/Projects/ReasonML/rescript-try(branch:master*) » npm run build
> new-project@0.0.1 build /Users/me/Projects/ReasonML/rescript-try
> bsb -make-world
[1/3] Building src/Demo.resast
FAILED: src/Demo.resast
/Users/me/Projects/ReasonML/rescript-try/node_modules/bs-platform/darwin/bsc.exe -warn-error +101 -o src/Demo.resast -bs-syntax-only -bs-binary-ast /Users/me/Projects/ReasonML/rescript-try/src/Demo.res
/bin/sh: /Users/me/Projects/ReasonML/rescript-try/node_modules/bs-platform/darwin/bsc.exe: No such file or directory
FAILED: subcommand failed.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! new-project@0.0.1 build: `bsb -make-world`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the new-project@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2020-08-22T17_57_46_386Z-debug.log
I see that the “bs-platform” folder takes up 1GB of space. So here I just “lost” 2GB of my hard drive.
Thats a little weird. Mine “just” takes up 150MB. I have no clue, why yours would be so much bigger.
PS. Just tried to uninstall the local package and run “build”. Got an error (I am on Mac):
If you run npm run clean (defined in package.json as bsb -clean-world), you will get a more helpful error message, stating the following:
Error: package bs-platform is not found
It's the basic, required package. If you have it installed globally,
Please run `npm link bs-platform` to make it available
The way I understand it: These are prebuilt binaries of rescript. Each Platform needs its own binary.
They are all published in the same npm package for convenience. Otherwise (or in case you’re using a platform which has no prebuilt binary) you would need to have the necessary toolchain installed and rescript would be built from scratch.
The reason why it’s also a local dependency: rescript also ships with js files which are needed during runtime.
I heard recent recommendations to install rescript only locally: If you have several projects using different rescript versions, having the dependency locally makes it more reproducable.
To use the init functionallity you could just use npx.
I think there was already an issue reported to make rescript compatible with yarn2, pnpm and the like.
It seems that you on running on a old mac os version so that the prebuilt binary does not work for you, then it triggers we build ocaml compiler which consumes lots of space
pnpm is not on our supported path so I’d caution against diverging into another package manager with sometime incompatible semantics.
This matter doesn’t warrant a package manager switch. That’s a huge knife for a small matter.