如何运行github上的simple-viewer-app例子代码


1.必备软件环境:
Node.js (latest 10.x or 12.x LTS version)
Google Chrome
Git

2.为了能够访问iModel数据,需要在如下网站进行注册(如果没有Bentley User Account,需要先用一个Bentley User Account)。
https://imodeljs.github.io/iModelJs-docs-output/getting-started/#developer-registration
Register Yourself , Register Your Application.

注册完之后,会将这2个信息发送至用户登记时所填写的邮箱。

3.通过git clone https://github.com/imodeljs/simple-viewer-app.git 到指定的目录。

将邮件收到的

Project name: simple-viewer-app
iModel name: simple-viewer-app

填写到文件config.json的第7,第8行处,同时放开注释,如下所示:

然后切换到project主目录

通过鼠标右键单击Git Bash Here来启动Git,开始输入一下命令:

1>npm install 依赖安装。如果一些依赖安装失败,请通过npm install xxx进行单独安装即可。

如:
npm install typedoc-plugin-internal-external@2.0.1
npm install @bentley/webpack-tools@1.4.0

2>npm run build 编译。

3>npm run start:servers 启动服务。

4>打开chrome等指定浏览器,输入localhost:3000 即可。

出现Open Sample iModel,然后点击其,请耐心等待,然后出现运行结果如下所示: