下载老师的源码,用open with live server为什么打不开

下载老师的源码,用open with live server为什么打不开

下载老师的源码,用open with live server为什么打不开,以前老师有讲过,忘记了,不知道在哪节课讲的了

https://img1.sycdn.imooc.com//climg/6191fbfb092894b613330303.jpg

麻烦老师给我在讲下。谢谢

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕慕子 2021-11-15 14:40:11

同学你好,源码不可以直接使用Live server插件打开。下载源码后,需要进入到项目所在的文件夹下,打开cmd窗口,先执行npm install 安装所有的依赖,然后执行npm run start启动项目。以一个为例:

1、进入到搜索框组件所在小节对应的源码m-mall文件夹下

https://img1.sycdn.imooc.com//climg/619200690945692b02970034.jpg

2、在当前文件夹下打开cmd窗口

https://img1.sycdn.imooc.com//climg/6192009709e7fab406710250.jpg

3、执行npm install 安装所有的依赖

https://img1.sycdn.imooc.com//climg/619200b30915bd3406620286.jpg

4、等待依赖安装完成后,执行npm run start启动项目即可。

祝学习愉快~

  • 提问者 曼曼前端 #1

    F:\BaiduNetdiskDownload\1、慕课网前端体系课学习\课件案例\慕云游商城WebApp源码\首

    页开发\头部组件的结构和样式\m-mall>npm install

    npm WARN old lockfile

    npm WARN old lockfile The package-lock.json file was created with an old version

     of npm,

    npm WARN old lockfile so supplemental metadata must be fetched from the registry

    .

    npm WARN old lockfile

    npm WARN old lockfile This is a one-time fix-up, please be patient...

    npm WARN old lockfile

    npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprec

    ated

    npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype

     pollution issue

    npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#dep

    recated

    npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy.

     new code should use the URLSearchParams API instead.

    npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older v

    ersions may use Math.random() in certain circumstances, which is known to be pro

    blematic.  See https://v8.dev/blog/math-random for details.

    npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade

    to chokidar 3 with 15x less dependencies.

    npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade

    to chokidar 3 with 15x less dependencies.

    npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 hav

    e a low-severity ReDos regression when used in a Node.js environment. It is reco

    mmended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/iss

    ues/797)

    npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 hav

    e a low-severity ReDos regression when used in a Node.js environment. It is reco

    mmended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/iss

    ues/797)

    npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 hav

    e a low-severity ReDos regression when used in a Node.js environment. It is reco

    mmended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/iss

    ues/797)

    npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 hav

    e a low-severity ReDos regression when used in a Node.js environment. It is reco

    mmended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/iss

    ues/797)

    npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 hav

    e a low-severity ReDos regression when used in a Node.js environment. It is reco

    mmended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/iss

    ues/797)


    added 703 packages in 27s


    F:\BaiduNetdiskDownload\1、慕课网前端体系课学习\课件案例\慕云游商城WebApp源码\首

    页开发\头部组件的结构和样式\m-mall>npm start


    > m-mall@1.0.0 start

    > webpack-dev-server --open chrome


    (node:51924) [DEP0131] DeprecationWarning: The legacy HTTP parser is deprecated.


    i 「wds」: Project is running at http://localhost:8080/

    i 「wds」: webpack output is served from /

    i 「wds」: Content not from webpack is served from F:\BaiduNetdiskDownload\1、慕课

    网前端体系课学习\课件案例\慕云游商城WebApp源码\首页开发\头部组件的结构和样式\m-m

    all

    i 「wdm」: wait until bundle finished: /

    i 「wdm」: Hash: b89567bb7b18d868cb2e

    Version: webpack 4.44.1

    Time: 5443ms

    Built at: 2021-11-15 3:04:07 ├F10: PM┤

                          Asset       Size       Chunks             Chunk Names

               destination.html   47 bytes               [emitted]

    fonts/PingFangSCRegular.ttf   10.7 MiB               [emitted]

                     index.html  897 bytes               [emitted]

              js/destination.js    892 KiB  destination  [emitted]  destination

                    js/index.js    963 KiB        index  [emitted]  index

    Entrypoint index = js/index.js

    Entrypoint destination = js/destination.js

    [0] multi (webpack)-dev-server/client?http://localhost:8080 ./src/pages/index 40

     bytes {index} [built]

    [1] multi (webpack)-dev-server/client?http://localhost:8080 ./src/pages/destinat

    ion 40 bytes {destination} [built]

    [./node_modules/strip-ansi/index.js] 161 bytes {index} {destination} [built]

    [./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpa

    ck)-dev-server/client?http://localhost:8080 4.29 KiB {index} {destination} [buil

    t]

    [./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/clien

    t/overlay.js 3.51 KiB {index} {destination} [built]

    [./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client

    /socket.js 1.53 KiB {index} {destination} [built]

    [./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-de

    v-server/client/utils/createSocketUrl.js 2.91 KiB {index} {destination} [built]

    [./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/cli

    ent/utils/log.js 964 bytes {index} {destination} [built]

    [./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-serv

    er/client/utils/reloadApp.js 1.59 KiB {index} {destination} [built]

    [./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-se

    rver/client/utils/sendMessage.js 402 bytes {index} {destination} [built]

    [./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\

    /log$ 170 bytes {index} {destination} [built]

    [./src/assets/styles/base.css] 530 bytes {index} [built]

    [./src/assets/styles/layout.css] 532 bytes {index} [built]

    [./src/pages/destination/index.js] 0 bytes {destination} [built]

    [./src/pages/index/index.js] 162 bytes {index} [built]

        + 36 hidden modules

    Child HtmlWebpackCompiler:

         2 assets

        Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0

        Entrypoint HtmlWebpackPlugin_1 = __child-HtmlWebpackPlugin_1

        [./node_modules/art-template/lib/compile/runtime.js] 2.29 KiB {HtmlWebpackPl

    ugin_0} {HtmlWebpackPlugin_1} [built]

        [./node_modules/art-template/lib/runtime.js] 61 bytes {HtmlWebpackPlugin_0}

    {HtmlWebpackPlugin_1} [built]

        [./node_modules/html-webpack-plugin/lib/loader.js!./src/pages/destination/de

    stination.art] 227 bytes {HtmlWebpackPlugin_1} [built]

        [./node_modules/html-webpack-plugin/lib/loader.js!./src/pages/index/index.ar

    t] 1.38 KiB {HtmlWebpackPlugin_0} [built]

        [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 b

    ytes {HtmlWebpackPlugin_0} {HtmlWebpackPlugin_1} [built]

        [./src/pages/index/components/header/header.art] 263 bytes {HtmlWebpackPlugi

    n_0} [built]

    i 「wdm」: Compiled successfully.





    之后怎么打开文件?

    2021-11-15 15:07:07
  • 提问者 曼曼前端 #2

    每一次打开页面都要跑一下npm run start吗?

    2021-11-15 15:16:26
  • 好帮手慕慕子 回复 提问者 曼曼前端 #3

    同学你好,对于你的问题解答如下:

    1、显示项目已经在下图所示地址启动了,如下:

    https://img1.sycdn.imooc.com//climg/6192128609c9d17006530213.jpg

    可以在浏览器中输入http://localhost:8080访问项目

    2、如果没有将cmd窗口关闭,那么就不用重新执行npm run start,如果将cmd窗口关闭了,想要再访问项目,那么就需要重新执行npm run start了。

    祝学习愉快~

    2021-11-15 15:57:35
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师