我是包裹和节点包的新手,我正在尝试使用包裹广告页面将我的项目部署到github页面。我在package.json
上创建了以下草稿
"build:parcel": "parcel build ./src/index.html"
问题是当它完成构建时,抛出错误[error:打开目录时出错]
✨ Built in 327ms
distindex.html 3.04 KB 3.02s
distindex.955ccd1a.css 183.28 KB 103ms
distindex.3e71ab34.js 2.26 KB 190ms
distindex.607dc078.js 173.57 KB 2.25s
[Error: Error opening directory]
有时,即使我运行脚本"start": "parcel ./src/index.html"
,包裹也不会创建dist文件夹。
我的完整package.json
:
{
"name": "herosacai",
"version": "1.0.0",
"homepage": "https://venifeitosa.github.io/herosacai/",
"description": "",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "parcel ./src/index.html",
"build:parcel": "parcel build ./src/index.html",
"clear:wind": "rd /s/q dist",
"build": "npm run clear:wind && npm run build:parcel",
"predeploy": "npm run build",
"deploy": "gh-pages -d dist"
},
"author": "",
"license": "ISC",
"dependencies": {
"bootstrap": "^5.2.0",
"jquery": "^3.6.0"
},
"devDependencies": {
"parcel": "^2.6.2"
}
}
我修复了在包裹脚本中添加参数--no-cache
的问题
之前:
"start": "parcel ./src/index.html"
"build:parcel": "parcel build ./src/index.html"
之后:
"start": "parcel ./src/index.html --no-cache"
"build:parcel": "parcel build ./src/index.html --no-cache"