1

尝试使用 docker-composer up 命令设置锯齿供应链,但出现以下错误。在版本为 0.10.1 的 Windows 10 笔记本电脑上运行。我已经从https://github.com/hyperledger/sawtooth-supply-chain下载了文件,并按照 readme.md 文件进行设置。

当我查找文件“/sawtooth-supply-chain/ledger_sync/index.js”时,我得到一个javascript语法错误,代码为800A03EA,源代码为Microsoft JScript编译错误。有人可以帮忙吗?

`supply-ledger-sync | module.js:549
supply-ledger-sync | throw err;
supply-ledger-sync | ^
supply-ledger-sync |
supply-ledger-sync | Error: Cannot find module '/sawtooth-supply-chain/ledger_sync/index.js'
supply-ledger-sync | at Function.Module._resolveFilename (module.js:547:15)
supply-ledger-sync | at Function.Module._load (module.js:474:25)
supply-ledger-sync | at Function.Module.runMain (module.js:693:10)
supply-ledger-sync | at startup (bootstrap_node.js:188:16)
supply-ledger-sync | at bootstrap_node.js:609:3
supply-shell | npm ERR! path /sawtooth-supply-chain/asset_client/package.json
supply-shell | npm ERR! code ENOENT
supply-shell | npm ERR! errno -2
supply-shell | npm ERR! syscall open
supply-rethink | Listening for client driver connections on port 28015
supply-server | module.js:549
supply-server | throw err;
supply-server | ^
supply-server |
supply-server | Error: Cannot find module '/sawtooth-supply-chain/server/index.js'
supply-server | at Function.Module._resolveFilename (module.js:547:15)
supply-server | at Function.Module._load (module.js:474:25)
supply-server | at Function.Module.runMain (module.js:693:10)
supply-server | at startup (bootstrap_node.js:188:16)
supply-server | at bootstrap_node.js:609:3
supply-rethink | Listening for administrative HTTP connections on port 8080
supply-shell | npm ERR! enoent ENOENT: no such file or directory, open '/sawtooth-supply-chain/asset_client/package.json'
supply-shell | npm ERR! enoent This is related to npm not being able to find a file.
supply-shell | npm ERR! enoent'

/sawtooth-supply-chain/server/index.js 的 index.js 中的代码如下:

/**
 * Copyright 2017 Intel Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ----------------------------------------------------------------------------
 */
'use strict'

const express = require('express')
const db = require('./db')
const blockchain = require('./blockchain')
const protos = require('./blockchain/protos')
const api = require('./api')
const config = require('./system/config')

const PORT = config.PORT
const app = express()

Promise.all([
  db.connect(),
  protos.compile(),
  blockchain.connect()
])
  .then(() => {
    app.use('/', api)
    app.listen(PORT, () => {
      console.log(`Supply Chain Server listening on port ${PORT}`)
    })
  })
  .catch(err => console.error(err.message))

问候 Ganesh Bhat

4

2 回答 2

1

我今天也用谷歌搜索了这个。JScript / Microsoft Windows Based Script Host无法处理 ECMAScript 类型语法或 Regex 功能。

对我来说,我发现这很可能归结为使用以下关键字:

  • let.
  • forEach
  • exec

(最后两个带有正则表达式匹配器)。

顺便说一句:代码是以下内容的合并:

  • regex101为 JavaScript 生成的内容,以及
  • Wscript 的东西来自这样的东西

我最终放弃了 JavaScript 并改用 VBScript,因为我试图为包含来自 Automation Anywhere 的多个组和一次包含多个结果的正则表达式调用脚本代码。

于 2019-11-27T19:21:04.340 回答
0

我不知道上面的解决方案,但是如果你安装一个像 VirtualBox 这样的 VM,然后在 VirtualBox 中使用 Docker 和 docker-compose 运行 Sawtooth,你会发现它会容易得多。

于 2018-08-17T23:06:07.687 回答