简体   繁体   English

通过启动外部文件 index.html I 忽略主文件,服务器在包裹中运行错误,但它也不起作用(构建失败)

[英]Server running error in parcel by starting the external file index.html I Ignoring the main but it also doesn't work(Build Failed)

[Build Error in parcel @ 2.7.0 start when I am trying to add external index.html file in the main I also ignored the main but it also doesn't work for me. [当我尝试在主文件中添加外部 index.html 文件时,包裹@ 2.7.0 开始构建错误我也忽略了主文件,但它对我也不起作用。 Will please someone help me to solve this problem It also not working with JavaScript file when I added externally and also getting error with html file but I want to add the html file but as a solution I try to add JavaScript file but it also doesn't work for me. Will please someone help me to solve this problem It also not working with JavaScript file when I added externally and also getting error with html file but I want to add the html file but as a solution I try to add JavaScript file but it also doesn'不适合我。 Will please someone solve this issue or tell me how to solve this issue请有人解决这个问题或告诉我如何解决这个问题

{
  "name": "forkify",
  "version": "1.0.0",
  "description": "",
  "main": "unrelated.js",
  "targets": {
    "main": false
  },
  "scripts": {
    "start": "parcel start index.html",
    "build": "parcel build index.html"
  },
  "author": "Meelad Sultan",
  "license": "ISC",
  "devDependencies": {
    "parcel": "^2.7.0"
  }
}

enter code here

At last I can find the solution of my problem after almost a day if someone else facing the same problem they just do add the **Browsers list ** in the package.json file before script and ignore the main target and also set the parcel to latest then the parcel will run successfully and do not give any server error or build error.最后我可以在几乎一天后找到我的问题的解决方案,如果其他人面临同样的问题,他们只是在脚本之前的package.json文件中添加**浏览器列表**并忽略主要目标并设置包裹到最近,包裹将成功运行,并且不会出现任何服务器错误或构建错误。 And don't forget to run periodically npx browerlist@latest --update-db.并且不要忘记定期运行npx browerlist@latest --update-db。 It will update your package-lock file with new caniuse-lite version.它将使用新的 caniuse-lite版本更新您的包锁定文件。 In this case, you will be sure that last two version or > 0.2% will target what you expect { "name": "forkify", "version": "1.0.0", "description": "", "main": "unrelated.js", "target": { "main": false }, "browserslist": "> 0.5%, last 2 versions, not dead", "scripts": { "start": "parcel index.html " }, "author": "Meelad Sultan", "license": "ISC", "devDependencies": { "@parcel/transformer-sass": "^2.7.0", "parcel": "latest" }, "dependencies": { "sass": "^1.55.0" } }在这种情况下,您将确定最后两个版本> 0.2%将针对您所期望的 { "name": "forkify", "version": "1.0.0", "description": "", "main" : "unrelated.js", "target": { "main": false }, "browserslist": "> 0.5%,最后 2 个版本,未死", "scripts": { "start": "parcel index.html " }, "author": "Meelad Sultan", "license": "ISC", "devDependencies": { "@parcel/transformer-sass": "^2.7.0", "parcel": "latest" }, “依赖”:{“sass”:“^1.55.0”}}

暂无
暂无

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

相关问题 @parcel/core: 无法解析“index.html”得到这个错误 - @parcel/core: Failed to resolve 'index.html' Getting this error npm run build不起作用。“在file://上打开index.html将不起作用。” - npm run build doesn't work.“Opening index.html over file:// won't work.” 使用“parcel index.html”后外部 .js 不起作用 - external .js not working after using “parcel index.html” Parcel Build Failed with error @parcel/resolver-default: Cannot load file '../../../../../css/main.css' in './src' - Parcel Build Failed with error @parcel/resolver-default: Cannot load file '../../../../../css/main.css' in './src' Newby:index.js 文件在 index.html 文件中不起作用 - Newby: index.js file doesn't work in index.html file 我通过运行 npm 运行构建构建了我的 Vuejs 应用程序,打开 index.html 引发错误:加载资源失败:net::ERR_FILE_NOT_FOUND - I built my Vuejs app by running npm run build, opening index.html throws errors: Failed to load resource: net::ERR_FILE_NOT_FOUND 为什么我的 script.js 文件不起作用,但 index.html 文件中的 JavaScript 代码起作用? - Why my script.js file doesn't work but the JavaScript code inside of the index.html file works? Gulp不会生成index.html - Gulp doesn't generate index.html HTML5 Boilerplate构建脚本不会替换index.html中的脚本标签 - HTML5 Boilerplate build scripts doesn't replace script tags in index.html HTML5在index.html中导入外部本地html文件 - HTML5 Importing external local html file in index.html
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM