问题描述
来自 openlayers 的这个研讨会文档
https://openlayers.org/workshop/en/basics/
包含一个示例。我正在尝试让它运行,但尽管两者都
npm start
npm run build
运行成功,但是当我访问本地主机时“请查看附件”
http://localhost:3000/
或
http://localhost:1234/
package.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"
} }
解决方法
不要停止这个过程。
npm start
然后让服务器运行(nicht abbrechen)并转到:
http://localhost:1234/
如果你运行:
npm run build
您必须将构建文件夹复制到服务器才能运行。