我正在通过Hyperledger Developer Guide Tutorial。我已经完成了生成REST API的步骤,没有任何问题。在完成生成您的Skeleton Web应用程序部分之后,我没有看到shell输出中的任何问题,但是当我尝试按照指示导航到端口4200时,我得到一个大多数空白的屏幕,上面写着Invalid Host header
。
在Rocketchat上的#composer频道中,我看到有人有一个similar problem。有人建议这是:
因为无法创建或访问keyValStore下的hlfv1配置文件中指定的目录。您很可能已指定了一个目录,例如/home/fred/.hfc-key-store,但用户fred不存在,因此目录/ home / fred不存在。一种解决方案就是自己创建目录路径。
我检查了一下,我的目录没问题:
ibmadmin@pfuntner1:~/repos$ cat /home/ibmadmin/.composer-connection-profiles/hlfv1/connection.json
{
"type": "hlfv1",
"orderers": [
{ "url" : "grpc://localhost:7050" }
],
"ca": { "url": "http://localhost:7054",
"name": "ca.org1.example.com"
},
"peers": [
{
"requestURL": "grpc://localhost:7051",
"eventURL": "grpc://localhost:7053"
}
],
"keyValStore": "/home/ibmadmin/.composer-credentials",
"channel": "composerchannel",
"mspID": "Org1MSP",
"timeout": "300"
}
ibmadmin@pfuntner1:~/repos$ ls -ld /home/ibmadmin/.composer-credentials
drwxrwxr-x 2 ibmadmin ibmadmin 4096 Sep 13 15:11 /home/ibmadmin/.composer-credentials
ibmadmin@pfuntner1:~/repos$ ls -l /home/ibmadmin/.composer-credentials
total 24
-rw-r--r-- 1 ibmadmin ibmadmin 246 Sep 13 15:10 114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457-priv
-rw-r--r-- 1 ibmadmin ibmadmin 182 Sep 13 15:11 114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457-pub
-rw-rw-r-- 1 ibmadmin ibmadmin 246 Sep 13 15:11 2a176af765281bb00394c2427cb7acc679d3eb9b504703eaba8c32a5a0f1a61c-priv
-rw-rw-r-- 1 ibmadmin ibmadmin 182 Sep 13 15:40 2a176af765281bb00394c2427cb7acc679d3eb9b504703eaba8c32a5a0f1a61c-pub
-rw-rw-r-- 1 ibmadmin ibmadmin 962 Sep 13 15:40 admin
-rw-r--r-- 1 ibmadmin ibmadmin 1024 Sep 13 15:11 PeerAdmin
ibmadmin@pfuntner1:~/repos$
有没有人有什么建议?
我补充说:
$ diff -C5 node_modules/@angular/cli/tasks/serve.js.orig node_modules/@angular/cli/tasks/serve.js
*** node_modules/@angular/cli/tasks/serve.js.orig 2017-09-14 12:20:45.462357278 -0400
--- node_modules/@angular/cli/tasks/serve.js 2017-09-14 11:27:55.682265096 -0400
***************
*** 158,167 ****
--- 158,168 ----
ui.writeLine(chalk.green(common_tags_1.oneLine `
**
NG Live Development Server is running on ${serverAddress}
**
`));
+ webpackDevServerConfiguration.disableHostCheck = true;
const server = new WebpackDevServer(webpackCompiler, webpackDevServerConfiguration);
return new Promise((_resolve, reject) => {
server.listen(serveTaskOptions.port, serveTaskOptions.host, (err, _stats) => {
if (err) {
return reject(err);
$
这似乎与webpack有关,虽然我自己没有看到这个问题。
我能够通过用我的实际IP地址替换package.json中的0.0.0.0主机参数来解决这个问题。它位于package.json文件的scripts部分:
"scripts": {
"ng": "ng",
"build": "ng build",
"prepack": "npm run build",
"start": "ng serve --proxy-config proxy.conf.js --host 0.0.0.0",
...
更改此项并运行“npm start”后,可以从远程主机访问端口4200。