gpt4 book ai didi

javascript - Parcel JS : tree. 渲染不是函数

转载 作者:行者123 更新时间:2023-12-04 04:32:00 24 4
gpt4 key购买 nike

每当我尝试运行生产构建命令 npm run buildnpx parcel build index.html ,我得到这个错误。我有一个简单的 html 和 css 项目,没有反应,没有 3rd 方库 为什么会发生这种情况?我尝试过包裹版本 1.12.3、1.12.4 和 1.12.5。
这是错误:

/Users/user/Documents/HTML Apps/Project/index.html: tree.render is not a function
at /Users/user/Documents/HTML Apps/Project/node_modules/htmlnano/lib/modules/minifySvg.js:19:23
at /Users/user/Documents/HTML Apps/Project/node_modules/posthtml/lib/api.js:91:45
at traverse (/Users/user/Documents/HTML Apps/Project/node_modules/posthtml/lib/api.js:105:26)
at traverse (/Users/user/Documents/HTML Apps/Project/node_modules/posthtml/lib/api.js:111:5)
at traverse (/Users/user/Documents/HTML Apps/Project/node_modules/posthtml/lib/api.js:105:17)
at traverse (/Users/user/Documents/HTML Apps/Project/node_modules/posthtml/lib/api.js:111:5)
at traverse (/Users/user/user/HTML Apps/Project/node_modules/posthtml/lib/api.js:105:17)
at traverse (/Users/user/Documents/HTML Apps/Project/node_modules/posthtml/lib/api.js:111:5)
at traverse (/Users/user/Documents/HTML Apps/Project/node_modules/posthtml/lib/api.js:105:17)
at traverse (/Users/user/Documents/HTML Apps/Project/node_modules/posthtml/lib/api.js:111:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Project@1.0.0 build: `parcel build index.html`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Project@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2021-04-14T07_44_52_872Z-debug.log

最佳答案

事实证明,您可以通过配置 htmlnano 来解决这个问题。不缩小 SVG。
添加 .htmlnanorc文件到您的项目根目录,使用如下 JSON 配置对象:

{
"minifySvg": false
}
文档的相关部分是 here for V1 (实际上没有提到 minifySvg 设置)或 here for V2 .

关于javascript - Parcel JS : tree. 渲染不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67087634/

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