我在尝试安装 Reprocessing 时遇到了很多麻烦,这是一种可以从 ReasonML 或 ReScript 中使用的基本图形库,并且已经以各种方式进行了更新,但是文档/README 有点不完整,并且有各种来源表示它可能与全局安装的 bucklescript 等之间存在冲突。
所以我的问题(我会自己回答)是“如何在 2021 年在 Mac 上安装 Reprocessing 并让演示程序显示一些图形?”
这是我在运行 Mojave 的 Mac 上执行的一系列操作,其中已经安装了 Node 和 Rescript,我想摆脱它们并从头开始。并非所有步骤都可能是必需的,但这些步骤有效。我应该提到 Python 也已安装。为此,我打开了一个运行 Bash 的终端窗口。一行中从“//”开始的所有内容都是注释。在我的主目录中,我还有一个名为的文件夹cs17
,其中有一些先前尝试的剩余垃圾。
npm uninstall -g bs-platform // get rid of bucklescript
nvm deactivate // get ready to uninstall Javascript
nvm uninstall node // do it
nvm install node // start with a fresh Javascript
npm install reprocessing // use the package manager to install reprocessing
cd ~/cs17 // go to the target directory
/bin/rm -rf * // and clean it out
git clone https://github.com/bsansouci/reprocessing-example.git // grab example code
npm install // I don't know why one should do this, but some instruction said to
cd reprocessing-example/ // change to the directory in which the sample code lives
npm install bsb // reinstall bsb, so that I can compile ReasonML and ReScript code
npm run build // compile everything (for "native" use perhaps?)
npm run build:web // compile things so that they can run in a browser
python -m SimpleHTTPServer // start a simple webserver than can serve up this project
最后,在 Chrome 中,访问http://localhost:8000/
并看到一个粉红色的正方形,上面画着一个较小的蓝色正方形。成功!
我希望这对其他人有用,即使它不是最终的(甚至不是理性的!)答案。