我的环境:MacOS Mojave
我使用
从他们的模板创建了VueJS应用程序class CircularButton(ButtonBehavior, Label):
# code inspired from:
# https://github.com/kivy/kivy/issues/4263#issuecomment-217430358
# https://stackoverflow.com/a/42886979/6924364
# https://blog.kivy.org/2014/10/updating-canvas-instructions-declared-in-python/
def __init__(self, **kwargs):
super(CircularButton,self).__init__(**kwargs)
with self.canvas.before:
Color(rgba=(.5,.5,.5,.5))
self.shape = Ellipse(pos=self.pos,size=self.size)
self.bind(pos=self.update_shape, size=self.update_shape)
def update_shape(self, *args):
self.shape.pos = self.pos
self.shape.size = self.size
def on_press(self, *args): #<--- what am I doing wrong here?
with self.canvas:
Color(rgba=(0,0,0,0))
def collide_point(self, x, y):
return Vector(x, y).distance(self.center) <= self.width / 2
那很好。该页面在localhost:8080上运行,并在ctrl-c时关闭。
然后我将其构建用于生产
vue init pwa frontend
? Project name frontend
? Project short name: fewer than 12 characters to not be truncated on homescreens (default: same as name)
? Project description A Vue.js project
? Author me@myemail.com
? Vue build runtime
? Install vue-router? Yes
? Use ESLint to lint your code? No
? Setup unit tests with Karma + Mocha? No
? Setup e2e tests with Nightwatch? No
yarn
yarn dev
我编写了一个快速的JS服务器,从dist /文件夹中启动内容,以查看构建后的外观。
yarn build
我运行服务器const ora = require('ora')
const chalk = require('chalk');
const express = require('express');
const port = process.env.PORT || 8080;
const app = express();
const spinner = ora(chalk.yellow("Your application is starting..."));
spinner.start();
var delay = ( function() {
var timer = 0;
return function(callback, ms) {
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
app.use(express.static(__dirname + "/dist/"));
app.get(/.*/, function(req, res) {
res.sendFile(__dirname + "/dist/index.html");
});
app.listen(port);
delay(function() {
app.use(express.static(__dirname + "/dist/"));
app.get(/.*/, function(req, res) {
res.sendFile(__dirname + "/dist/index.html");
});
}, 3000);
spinner.stop();
console.log(chalk.cyan("Your application is running here: ") + ("http://localhost:8080"));
但是,当我按ctrl-c时,它会杀死脚本,但是应用程序仍在localhost:8080上运行
我尝试了node server.js
和sudo lsof -i tcp:8080
,但它们均未返回任何内容。这给我留下了以下问题:如何停止监听8080端口?
答案 0 :(得分:1)
如果有人想知道,我发现了问题所在。我不得不去chrome://serviceworker-internals
和chrome://appcache-internals
。我搜索了localhost:8080
,并杀死了那些服务人员。
我希望这对下一个发生的人有帮助!