Ex-bond-issuance in standalone without automations

Hey DAML’ers!

I’m working with the ex-bond-issuance model but am having some trouble getting it to work in Standalone on my Windows machine.

The one caveat is that I am not (right now) interested in the java automations if I don’t have to be right now. Our current demo doesn’t use them, and if we don’t have to, we probably wouldn’t use them for right now.

Here are the sequential command line steps I have taken according to the Makefile:

python scripts/getfinlib.py 1.7.0
daml build -o target/bond-issuance.dar
daml start --sandbox-option --address=localhost --sandbox-option -w --open-browser no
daml codegen js target/bond-issuance.dar -o daml.js
daml codegen js target/finlib-1.7.0.dar -o daml.js
cd ui-js
yarn install
yarn start

When I run yarn start I get the following error:

    C:\Users\James Jaworski\OneDrive\Optimis\ex-bond-issuance-master\ui-js>yarn start
    yarn run v1.19.1
    $ NODE_ENV=development react-scripts start
    'NODE_ENV' is not recognized as an internal or external command,
    operable program or batch file.
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This is what the Sandbox looks like:

    C:\Users\James Jaworski\OneDrive\Optimis\ex-bond-issuance-master>daml start --sandbox-option --address=localhost --sandbox-option -w --open-browser no
Compiling bond-issuance to a DAR.
Created .daml\dist\bond-issuance-2.0.0.dar
Waiting for sandbox to start:
INFO: Slf4jLogger started
INFO: Listening on localhost:6865 over plain text.
Running the initialization script.
   ____             ____
  / __/__ ____  ___/ / /  ___ __ __
 _\ \/ _ `/ _ \/ _  / _ \/ _ \\ \ /
/___/\_,_/_//_/\_,_/_.__/\___/_\_\

INFO: Initialized sandbox version 1.7.0 with ledger-id = bond-issuance, port = 6865, dar file = List(.daml\dist\bond-issuance-2.0.0.dar), time mode = wall-clock time, ledger = in-memory, auth-service = AuthServiceWildcard$, contract ids seeding = strong
[DA.Internal.Prelude:540]: "Ledger is being initialized..."
[DA.Internal.Prelude:540]: "Ledger is initialized."
Waiting for navigator to start:
   _  __          _           __
  / |/ /__ __  __(_)__ ____ _/ /____  ____
 /    / _ `/ |/ / / _ `/ _ `/ __/ _ \/ __/
/_/|_/\_,_/|___/_/\_, /\_,_/\__/\___/_/
                 /___/
Version 1.7.0
Frontend running at http://localhost:7500.
.Waiting for JSON API to start:
19:42:22.716 [main] INFO  com.daml.http.Main$ - Config(ledgerHost=localhost, ledgerPort=6865, address=127.0.0.1, httpPort=7575, portFile=None, packageReloadInterval=5 seconds, packageMaxInboundMessageSize=None, maxInboundMessageSize=4194304, tlsConfig=TlsConfiguration(false,None,None,None,REQUIRE), jdbcConfig=None, staticContentConfig=None, allowNonHttps=true, accessTokenFile=None, wsConfig=None)
19:42:24.498 [http-json-ledger-api-akka.actor.default-dispatcher-7] INFO  akka.event.slf4j.Slf4jLogger - Slf4jLogger started
19:42:27.319 [http-json-ledger-api-akka.actor.default-dispatcher-8] INFO  com.daml.http.HttpService$ - Connected to Ledger: bond-issuance
19:42:27.321 [http-json-ledger-api-akka.actor.default-dispatcher-8] INFO  com.daml.http.HttpService$ - contractDao: None19:42:28.652 [http-json-ledger-api-akka.actor.default-dispatcher-8] INFO  com.daml.http.PackageService - new package IDs loaded: 1f6769c5726355af704dda86ed94b15f6ecfbfdfc6a52a2a6792fbc257be3902, c1f1f00558799eec139fb4f4c76f95fb52fa1837a5dd29600baa1c8ed1bdccfd, 733e38d36a2759688a4b2c4cec69d48e7b55ecc8dedc8067b815926c917a182a, bfcd37bd6b84768e86e432f5f6c33e25d9e7724a9d42e33875ff74f6348e733f, 518032f41fd0175461b35ae0c9691e08b4aea55e62915f8360af2cc7a1f2ba6c, cc348d369011362a5190fe96dd1f0dfbc697fdfd10e382b9e9666f0da05961b7, 6839a6d3d430c569b2425e9391717b44ca324b88ba621d597778811b2d05031d, 99a2705ed38c1c26cbb8fe7acf36bbf626668e167a33335de932599219e0a235, 76bf0fd12bd945762a01f8fc5bbcdfa4d0ff20f8762af490f8f41d6237c6524f, 170c25c1822e97ba83d08d4fcf443be21fcd7cc305f37659d8c9ba6aab2c6842, e22bce619ae24ca3b8e6519281cb5a33b64b3190cc763248b4c3f9ad5087a92c, d58cf9939847921b2aab78eaa7b427dc4c649d25e6bee3c749ace4c3f52f5c97, 6c2c0667393c5f92f1885163068cd31800d2264eb088eb6fc740e11241b2bf06, d14e08374fc7197d6a0de468c968ae8ba3aadbf9315476fd39071831f5923662, 057eed1fd48c238491b8ea06b9b5bf85a5d4c9275dd3f6183e0e6b01730cc2ba, bfd4ef9f797e02f1cdbb3fea941b04683089c0b627fee96106d697e61a360d83, e8750bc69d5e0ecaebbaffb8cdd927015674be6753aa1c9e6a390d7ae68ff8cd, e491352788e56ca4603acc411ffe1a49fefd76ed8b163af86cf5ee5f4c38645b, 40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7, 5894d748a7e97b8fd49ca4dab20543066ad2fcfb4435ae2062cbc335bbb69734, ac9677ef0dcbb2cac09a2f9c90aae9896f225a20a34bb1f9248ffb8c4bec7594, 8a7806365bbd98d88b4c13832ebfa305f6abaeaf32cfa2b7dd25c4fa489b79fb
19:42:29.694 [http-json-ledger-api-akka.actor.default-dispatcher-8] INFO  com.daml.http.Main$ - Started server: ServerBinding(/127.0.0.1:7575)
..
Press 'r' + 'Enter' to re-build and upload the package to the sandbox.
Press 'Ctrl-C' to quit.

Are the automations required so that the application understands if it’s being started in development or docker?

Or is there some sandbox option that allows me to launch the application without having to run the automation steps?

Thanks!

1 Like

The issue isn’t the lack of automation, it’s another Unixsm that doesn’t work on Windows:

NODE_ENV=development react-scripts start

will start react-scripts start with the environment variable NODE_ENV set to development. This syntax doesn’t work on Windows. I suggest to remove NODE_ENV=development from package.json and instead set it in powershell before you call yarn start via

$env:NODE_ENV="development"
3 Likes

If you’re not using PowerShell, you can set the env var in cmd.exe using the set command. This would look like:

set NODE_ENV=development
yarn start
3 Likes

Thanks @cocreature and @Gary_Verhaegen. I was able to get up and running by setting the env var like Gary suggested.

I then changed the start command in the package.json to look like this:

  "scripts": {
"start": "react-scripts start",
"start-docker": "NODE_ENV=docker react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint --ext .js,.jsx,.ts,.tsx --max-warnings 0 src/" }

Once I did this, it was good to go.

2 Likes