简体   繁体   English

包裹捆绑器不会安装

[英]parcel-bundler won't install

new to web development and came across this error message while trying to build for production in the terminal. Web 开发新手,并在尝试在终端中构建生产时遇到此错误消息。

Tried entering: parcel build index.html尝试输入:parcel build index.html

Error message I get:我得到的错误信息:

🚨 Build failed. 🚨 构建失败。

@parcel/namer-default: Target "main" declares an output file path of "index.js" which does not match the compiled bundle type "html". @parcel/namer-default:目标“main”声明了“index.js”的输出文件路径,它与编译的包类型“html”不匹配。

Not sure what this means since I am still learning.不知道这意味着什么,因为我还在学习。 Any help would be appreciative.任何帮助将不胜感激。 Thank you in advance.先感谢您。

I literally just found a solution after posting this question.发布此问题后,我确实找到了解决方案。

So I went inside, "package.json", file and cleared the "main": "index.js", and tried building the parcel again in terminal and it worked.所以我进入了“package.json”文件并清除了“main”:“index.js”,并尝试在终端中再次构建包裹并且它起作用了。 Maybe the problem was the, "main": "index.js", had a 'index.js' and my index was in .html.也许问题是“main”:“index.js”,有一个“index.js”,而我的索引在 .html 中。 So after clearing the,"main": "index.js", solved my problem.所以在清除“main”:“index.js”之后,解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM