首页 > 解决方案 > 本地主机无法显示在 javascript 中创建的输出映射

问题描述

这个来自 openlayers 的研讨会文件

https://openlayers.org/workshop/en/basics/

包含一个例子。我试图让它运行,但尽管两者

npm start
npm run build 

运行成功,但是当我访问本地主机时“请查看附件图像”

http://localhost:3000/

或者

http://localhost:1234/

什么都不能显示。请让我知道如何解决这个问题

包.json

    {
  "name": "app6",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "parcel index.html",
    "build": "parcel build --public-url . index.html"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "ol": "^6.5.0"
  },
  "devDependencies": {
    "parcel-bundler": "^1.12.5"

} }

图片

在此处输入图像描述

标签: javascriptnpmopenlayersnpm-installopenlayers-3

解决方案


不要停止这个过程。

npm start

然后让服务器运行(nicht abbrechen)并转到:

http://localhost:1234/

如果你运行:

npm run build 

您必须将构建文件夹复制到服务器才能运行。


推荐阅读