gpt4 book ai didi

html - npm 开始 : Manual browser refresh to reflect changes

转载 作者:行者123 更新时间:2023-12-04 09:16:01 25 4
gpt4 key购买 nike

我正在学习 Node.js,在介绍性类(class)中,我必须设置 node 和 npm。现在根据讲师的说法,在终端中键入“npm start”然后在 index.html 文件中进行更改后,浏览器应该会自动刷新选项卡以使更改生效,但在我的情况下,每次我进行更改我必须手动刷新 Safari 选项卡才能查看更改。
请注意我使用的是同一台机器,即本身没有服务器端和客户端。操作系统为 macOS Catalina 10.15.6。
请问有什么可能的修复方法吗?
谢谢
文件结构:
enter image description here
package.json 文件:

  {
"name": "confusion",
"version": "1.0.0",
"description": "This is a website for Ristorante Con Fusion",
"main": "index.html",
"scripts": {
"start": "npm run lite",
"test": "echo \"Error: no test specified\" && exit 1",
"lite": "lite-server"
},
"author": "Raffay",
"license": "ISC",
"devDependencies": {
"lite-server": "^2.5.4"
},
"dependencies": {
"bootstrap": "^4.5.0",
"jquery": "^3.5.1",
"nodemon": "^2.0.4",
"popper.js": "^1.16.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/RaffaySajjad/conFusion.git"
},
"keywords": [
"conFusion"
],
"bugs": {
"url": "https://github.com/RaffaySajjad/conFusion/issues"
},
"homepage": "https://github.com/RaffaySajjad/conFusion#readme"
}
使用命令“nodemon”从终端启动 nodemon 打印以下错误
raffaysajjad@192 ~ % cd /Users/raffaysajjad/Desktop/Full\ Stack\ Web\ Development\ \(React\ Specialization\)/Course\ 1\ \(Front-End\ WebUI\ Frameworks\ \&\ Tools\ -\ Bootstrap\ 4\)/Week\ 1/Exercise/conFusion
raffaysajjad@192 conFusion % nodemon
[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: html,json
[nodemon] starting `node index.html`
/Users/raffaysajjad/Desktop/Full Stack Web Development (React Specialization)/Course 1 (Front-End WebUI Frameworks & Tools - Bootstrap 4)/Week 1/Exercise/conFusion/index.html:1
<!DOCTYPE html>
^

SyntaxError: Unexpected token '<'
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
[nodemon] app crashed - waiting for file changes before starting...

最佳答案

这是通过使用 nodemon 的 npm 包完成的,
如何使用

npm install -g nodemon
并在您的 package.json 中使用它
 "scripts": {
"start": "nodemon npm run lite"
},
更多关于 nodemon learn这里

关于html - npm 开始 : Manual browser refresh to reflect changes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63213677/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com