会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133467个问题

老师:

     下午好!我改为vue-cli.3.011后,可以跑起来了,前后台通行,但在cmd运行中出现以下截图中的现像“[nodemon] app crashed - waiting for file changes before starting...”,怎样处理呢?谢谢!




D:\project zl\egoshop\egoshop>npm run dev


> egoshop@0.1.0 dev D:\project zl\egoshop\egoshop

> concurrently "npm run serve" "nodemon mock/index.js"


[1] [nodemon] 2.0.7

[1] [nodemon] to restart at any time, enter `rs`

[1] [nodemon] watching path(s): *.*

[1] [nodemon] watching extensions: js,mjs,json

[1] [nodemon] starting `node mock/index.js`

[1] events.js:287

[1]       throw er; // Unhandled 'error' event

[1]       ^

[1]

[1] Error: listen EADDRINUSE: address already in use :::3002

[1]     at Server.setupListenHandle [as _listen2] (net.js:1313:16)

[1]     at listenInCluster (net.js:1361:12)

[1]     at Server.listen (net.js:1449:7)

[1]     at Function.listen (D:\project zl\egoshop\egoshop\node_modules\_express@4.17.1@express\lib\application.js:618:24)

[1]     at Object.<anonymous> (D:\project zl\egoshop\egoshop\mock\index.js:27:5)

[1]     at Module._compile (internal/modules/cjs/loader.js:1133:30)

[1]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)

[1]     at Module.load (internal/modules/cjs/loader.js:977:32)

[1]     at Function.Module._load (internal/modules/cjs/loader.js:877:14)

[1]     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)

[1] Emitted 'error' event on Server instance at:

[1]     at emitErrorNT (net.js:1340:8)

[1]     at processTicksAndRejections (internal/process/task_queues.js:84:21) {

[1]   code: 'EADDRINUSE',

[1]   errno: 'EADDRINUSE',

[1]   syscall: 'listen',

[1]   address: '::',

[1]   port: 3002

[1] }

[1] [nodemon] app crashed - waiting for file changes before starting...


WEB前端全系列/第二十阶段:Vue2企业级项目(旧)/Ego商城高级Vue实战项目 962楼

老师,我在使用多线程爬取文件的时候,会出现文件写入不全,然后我在写入文件的的时候加入锁,但是发现还写入不全,您帮我看一下!

from threading import Thread,Lock
import requests
from lxml import etree
from fake_useragent import UserAgent
from queue import Queue
class Spider(Thread):
    def __init__(self,url_queue,lock):
        Thread.__init__(self)
        self.url_queue = url_queue
        self.lock = lock

    def run(self):
        while not self.url_queue.empty():
            url = self.url_queue.get()
            print(url)
            headers = {'User-Agent':UserAgent().chrome}
            resp = requests.get(url,headers=headers)
            e = etree.HTML(resp.text)
            contents = [div.xpath('string(.)').strip() for div in e.xpath('//div[@class="content"]')]
            #加入锁
            self.lock.acquire()
            with open('qiushi.text', 'a', encoding='utf-8')as f:
                for content in contents:
                    f.write(content+'\n')
            self.lock.release()
if __name__ == '__main__':
    base_url = 'https://www.qiushibaike.com/text/page/{}/'
    lock = Lock()
    url_queue = Queue()
    for num in range(1,14):
        url_queue.put(base_url.format(num))
    for i in range(6):
        spider = Spider(url_queue,lock)
        spider.start()


Python 全系列/第十六阶段:Python 爬虫开发/爬虫反反爬- 963楼

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #container {
            display: grid;
            grid-template-columns: 200px 200px 200px;
            grid-template-rows: 200px 200px 200px 200px 200px 200px;
            grid-template-areas: "item1 item1 item2"
                                 "item1 item1 item3"
                                 "item3 item3 item3"
                                 "item4 item5 item6"
                                 "item7 item8 item9"
                                 "item9 item9 item9";
        }

        .item{
            font-size: 30px;
            border: 1px solid #e5e4e9;
            text-align: center;
            line-height: 200px;
        }

        .item-1 {
            grid-area: item1;
            background-color: #ef342a;
        }

        .item-2 {
            grid-area: item2;
            background-color: #f68f26;
        }

        .item-3 {
            grid-area: item3;
            background-color: #4ba946;
        }

        .item-4 {
            grid-area: item4;
            background-color: #0376c2;
        }

        .item-5 {
            grid-area: item5;
            background-color: #c077af;
        }

        .item-6 {
            grid-area: item6;
            background-color: #f8d29d;
        }

        .item-7 {
            grid-area: item7;
            background-color: #b5a87f;
        }

        .item-8 {
            grid-area: item8;
            background-color: #d0e4a9;
        }

        .item-9 {
            grid-area: item9;
            background-color: #4dc7ec;
        }
    </style>
</head>

<body>
    <div id="container">
        <div class="item item-1">1</div>
        <div class="item item-2">2</div>
        <div class="item item-3">3</div>
        <div class="item item-4">4</div>
        <div class="item item-5">5</div>
        <div class="item item-6">6</div>
        <div class="item item-7">7</div>
        <div class="item item-8">8</div>
        <div class="item item-9">9</div>
    </div>
</body>

</html>

为什么我的代码运行出来效果不对

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 964楼
WEB前端全系列/第二阶段:JavaScript编程模块/DOM模型 965楼
JAVA 全系列/第六阶段:项目管理与SSM框架/SpringMVC 966楼
JAVA 全系列/第九阶段:SpringBoot与MybatisPlus/Spring Boot旧 968楼
Python 全系列/第十阶段:前端进阶-高效开发Vue框架/Vue3 969楼
JAVA 全系列/第九阶段:SpringBoot与MybatisPlus/Spring Boot旧 971楼
Python 全系列/第二十四阶段:人工智能基础_机器学习理论与实战/Kaggle竞赛 974楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637