小编arc*_*ryx的帖子

页面加载时,与_next/webpack-hmr的连接中断

使用Next.js - 构建这个

我将我的应用程序移植到nextjs框架.目前,我正在重新创建身份验证系统,否则我的应用程序的这个迭代是非常简单的.突然,在添加我的受保护路线(高阶组件)后 - 不确定是否相关 - 我开始得到这个错误以及超级笨重的加载(显然).

The connection to http://localhost:3000/_next/webpack-hmr was interrupted while the page was loading.

否则一切都按预期工作.

我不知道如何开始解决这类问题.有没有人对我如何获得有关此问题的更多信息/见解有任何想法?如何调试指导?我的下一步行动是开始断开连接,直到它消失为止.任何帮助,将不胜感激!谢谢

reactjs mobx nextjs

25
推荐指数
1
解决办法
2079
查看次数

与样式组件一起使用的伪类之前和之后

将样式:before:after伪类应用于样式化组件的正确方法是什么?

我知道你可以使用

&:hover {}

:hover伪类应用于样式化组件.

这是否适用于之前和之后的所有伪元素?

我已经尝试使用&:before&:after策略一些相当复杂的例子,我不确定我的尝试是否工作,因为我的例子有问题,或者它不能像那样工作.

有人对此有一些了解吗?谢谢.

pseudo-class reactjs styled-components

23
推荐指数
3
解决办法
2万
查看次数

React + Firebase存储+文件上传和进度显示

我一直在寻找上传shenanigan的firebase存储图片.我被卡住了.我该如何展示上传进度?我刚刚意识到使用状态可能不是要走的路,因为我会一遍又一遍地调用setState.想法你好吗?

我想我需要某种递归函数,但我在哪里调用呢?我不能称之为我的承诺吗?

// You'll need to set the rules to allow un-authed uploading however.
// Here's how to allow public: goto your firebase console and select the storage tab then the rules tab and change to:
//
// service firebase.storage {
//  match /b/{bucket}/o {
//    match /{allPaths=**} {
//      allow read, write;
//    }
//  }
// }
//
//
// I just threw together an infinite grow animation here for shits, however, I use styled components in my …
Run Code Online (Sandbox Code Playgroud)

file-upload firebase reactjs firebase-storage

8
推荐指数
1
解决办法
4970
查看次数

yarn / npm Bulld 完成然后无限期挂起

有人对此有经验吗?运行yarn build完成构建但永远不会退出进程,它只是挂起......当我运行时也会发生同样的事情npm run build

stars-app|master? ? yarn build
yarn build v0.27.5
$ react-scripts build
Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  132.04 KB  build/static/js/main.54f97667.js
  24.93 KB   build/static/css/main.43aab3e7.css

The project was built assuming it is hosted at the server root.
To override this, specify the homepage in your package.json.
For example, add this to build it for GitHub Pages:

  "homepage" : "http://myname.github.io/myapp",

The build folder is ready to be deployed.
You may serve it …
Run Code Online (Sandbox Code Playgroud)

npm reactjs webpack yarnpkg

7
推荐指数
0
解决办法
1061
查看次数

节点续集 (MSSQL) - 用户 '' 登录失败

然而,我遇到了几个关于这个问题的帖子,但似乎没有一个有实际答案。几个想法,但没有一个奏效。

在挖掘了 Sequelize 和 Tedious 包并看到我的配置正确传递之后,我不知所措。

我正在尝试针对 MSSQL 中的新数据库运行迁移。我使用我在这里使用的相同凭据连接到它没有问题,所以我知道这不是问题。

我有我的 config.js 正在拉环境变量。除了我的自定义控制台语句之外,这个文件是从 sequelize 自动生成的,并且在我的 sequelizerc 中被正确引用

require('dotenv').config()
console.log('[+] Loading database config...')

if (process.env.NODE_ENV === 'production') {
  console.log(`[+] Using database: ${process.env.PROD_DB_DATABASE}`)
} else if (process.env.NODE_ENV === 'development') {
  console.log(`[+] Using database: ${process.env.DEV_DB_DATABASE}`)
} else if (process.env.NODE_ENV === 'test') {
  console.log(`[+] Using database: ${process.env.TEST_DB_DATABASE}`)
} else if (process.env.NODE_ENV === 'local') {
  console.log(`[+] Using database: ${process.env.LOCAL_DB_DATABASE}`)
} else {
  console.log(`[-] CANNOT LOAD DATABASE FROM ENV: ${process.env.NODE_ENV}`)
  process.exit()
}

module.exports = {
  production: { …
Run Code Online (Sandbox Code Playgroud)

sql-server node.js sequelize.js tedious

7
推荐指数
1
解决办法
4951
查看次数

用casper实时聊天刮(Youtube).选择聚合物元素的问题

我试图使用casper从youtube实时聊天源中删除文本.我在选择正确的选择器时遇到问题.每个被推出的新消息都有许多嵌套元素和动态生成的元素.怎么可能继续拉嵌套

<span id="message">some message</span>

他们发生了什么?我目前似乎无法抓住一个甚至一个!这是我的测试代码:注意:您可以替换任何具有实时聊天Feed的youtube网址.

const casper = require("casper").create({
  viewportSize: {
    width: 1080,
    height: 724
  }
});
const ua = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0'
const url = "https://www.youtube.com/watch?v=NksKCLsMUsI";
casper.start();
casper.userAgent(ua)
casper.thenOpen(url, function() {
  this.wait(3000, function() {
    if (this.exists("span#message")) {
      this.echo("found the a message!");
    } else {
      this.echo("can't find a message");
    }
    casper.capture("test.png");
  });
});

casper.run();
Run Code Online (Sandbox Code Playgroud)

我的问题正是这样.如何正确选择消息?2,我怎么能不断听新的呢?

更新:我一直在玩噩梦(电子测试套件),这看起来很有希望,但我仍然无法选择聊天元素.我知道我错过了一些简单的事情.

编辑/更新(使用cadabra的好例子)

var casper = require("casper").create({
  viewportSize: {
    width: 1024,
    height: 768
  }
});

url = 'https://www.youtube.com/live_chat?continuation=0ofMyAMkGiBDZzhLRFFvTFJVRTFVVlkwZEV4MFRFVWdBUSUzRCUzRDAB'
ua = …
Run Code Online (Sandbox Code Playgroud)

javascript youtube casperjs polymer

6
推荐指数
1
解决办法
715
查看次数

从语义UI反应下拉菜单中删除插入符号

有谁知道如何删除<Menu><Dropdown>...组件上的插入符号?

据我所知,该组件的属性列表没有标志。有任何人对此有经验吗?

import React from 'react'
import { Dropdown, Menu } from 'semantic-ui-react'
import { Menu as MenuIcon } from 'react-feather'

// this automatically renders a right-hand caret on the menu
// I added my own icon 'MenuIcon' from the feather icon set 
// and i want to get rid of the caret
const Header = () => (
  <Menu vertical compact>
    <Dropdown item text={<MenuIcon/>}>
      <Dropdown.Menu>
        <Dropdown.Item>Electronics</Dropdown.Item>
        <Dropdown.Item>Automotive</Dropdown.Item>
        <Dropdown.Item>Home</Dropdown.Item>
      </Dropdown.Menu>
    </Dropdown>
  </Menu>
)

export default Header
Run Code Online (Sandbox Code Playgroud)

reactjs semantic-ui semantic-ui-react

6
推荐指数
1
解决办法
2119
查看次数

获取所有公共用户贡献,又名“日历数据”(github api v3)

我发现了很多线程——甚至有几个项目使用 github api 之外的 api 嵌入了贡献日历——但这些方法或线程都没有真正回答这个问题。有一件事很接近,但这是不可能的。

我只是想获取用户的贡献总数,如 github 个人资料页面上的日历所示,如下所示......

在此输入图像描述

api 文档描述了收集 Repo Contrib 数据,因此我尝试用有根据的猜测盲目地尝试 api,但没有成功。有谁知道这个数据实际上是否有一个可行的端点?我真的需要自己计算这些信息还是做一些肮脏的 html 抓取废话?这看起来很愚蠢...有人吗?

更新:对于任何寻求快速网络抓取解决方案的人来说,这是一个使用cheerio和正则表达式的解决方案

const axios = require('axios')
const cheerio = require('cheerio')
const url = 'https://github.com/archae0pteryx'

function getCommits(url) {
    return new Promise((resolve, reject) => {
        axios.get(url).then(res => {
            const load = cheerio.load(res.data)
            const parsed = load('div.js-contribution-graph > h2').text()
            const reg = /\d+/g
            const x = parsed.match(reg)
            resolve(x)
        }).catch(err => reject(err))
    })
}


getCommits(url)
    .then(x => console.log(x))
    .catch(err => console.error(err))
Run Code Online (Sandbox Code Playgroud)

curl github github-api

5
推荐指数
1
解决办法
1294
查看次数

Python Django Errno 54'对等重置连接'

调试时遇到了一些麻烦。我总是在第一次启动我的应用程序时收到此错误,然后在以后间歇性地启动。有人可以通过一些调试技术来帮助我吗?我尝试使用代理检查器-无济于事,我看不到任何有用的东西。我尝试了有关在Django设置中设置SITE_URL的建议。我尝试过使用和不使用http://以及使用和不使用端口...这是无用的错误:

Exception happened during processing of request from ('127.0.0.1', 57917)
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 720, in __init__
    self.handle()
  File "/Users/ryan/.local/share/virtualenvs/portal-2PUjdB8V/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 171, in handle
    self.handle_one_request()
  File "/Users/ryan/.local/share/virtualenvs/portal-2PUjdB8V/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 179, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer
Run Code Online (Sandbox Code Playgroud)

即使重置此连接,该应用程序似乎也能正常运行,但它一直让我疯狂地尝试调试。

python sockets django

5
推荐指数
2
解决办法
916
查看次数

vscode 中的 Python 单元测试调试

我想在运行单元测试模块时附加一个调试器。我似乎无法通过谷歌找到任何有关此的信息。有人有允许调试 python 测试运行程序的配置吗?另一个是我使用 discovery arg 来匹配我的测试模式。我不介意必须调试单个文件,但只要用一个配置来启动调试器就好了,每当我需要更改为不同的文件时,我不需要胡闹。

python -m unittest discover -p "*_test.py"

我尝试添加此配置

    {
      "name": "Python: Unittest",
      "type": "python",
      "request": "launch",
      "module": "unittest",
      "args": ["discover", "-p", "'*_test.py'"]
    },
Run Code Online (Sandbox Code Playgroud)

但我收到no matches found: '*_test.py'错误...

有人有想法吗?另一种调试单元测试运行程序的方法?

python debugging python-unittest visual-studio-code

5
推荐指数
1
解决办法
1万
查看次数

在滚动时触发ReactCSSTransitionGroup

我一直试图弄清楚如何在滚动时触发react css过渡组.假设我有一堆组件,这个例子被渲染出屏幕:

// component.jsx

import React from 'react'
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'
import './style.css'
export default class extends React.Component {
    constructor() {
    super()
    this.state = {
      title: ['an off screen title']}
    }
    render() {
    const displayText = this.state.title.map(i => <h1 key={i}>{i.title}</h1>)
      return (
        <ReactCSSTransitionGroup
            transitionName='atxt'
            transitionEnterTimeout={1000}
            transitionLeaveTimeout={1000}>
          {displayText}
        </ReactCSSTransitionGroup>
      )
    }
}
Run Code Online (Sandbox Code Playgroud)

// style.css

.atxt-enter {
  opacity: 0.01;
}
.atxt-enter.atxt-enter-active {
  opacity: 1;
  transition: opacity 1000ms ease-in;
}
.atxt-leave {
  opacity: 1;
}
.atxt-leave.atxt-leave-active {
  opacity: 0.01;
  transition: opacity 1000ms …
Run Code Online (Sandbox Code Playgroud)

javascript css3 reactjs reactcsstransitiongroup

2
推荐指数
1
解决办法
1963
查看次数

Axios条纹问题。“ invalid_request_error”

我不知道该怎么做!我正在尝试通过Stripe API创建客户。用他们的例子卷曲我没有问题。这是他们的例子:

curl https://api.stripe.com/v1/customers \ -u sk_test_apikey: \ -d description="Customer for zoey.brown@example.com" \ -d source=tok_visa

当我尝试使用axios执行此操作时,出现错误“ invalid_request_error”,因为它无法正确解析我的数据。这是我所拥有的:

export const registerNewUser = async (firstName, lastName, email, password) => {
  let config = {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': `Bearer ${stripeTestApiKey}`
    }
  }
  let data = {
      email: `${email}`,
      description: `Customer account for ${email}`
  }
  await axios.post(stripeCustomerUri, data, config)
    .then(res => {
      console.log("DEBUG-axios.post--res: ", res)
    })
    .catch(err => {
      console.log(JSON.stringify(err, null, 2))
    })
}
Run Code Online (Sandbox Code Playgroud)

在我的控制台中,我看到条带没有以正确的方式接收我的数据。这是(我的有用部分)响应json:

"response": { 
  "data": { 
    "error": { 
      "type": …
Run Code Online (Sandbox Code Playgroud)

javascript stripe-payments axios

0
推荐指数
1
解决办法
758
查看次数