I have published a git repo () to Netlify (/) after following an Udemy tutorial:
Everything works locally, but when I deploy it I get
Uncaught ReferenceError: Fraction is not defined
at View.js:96
Fraction
is not even inside View.js
module: .js
It is inside another one: .js
I don't know how to recreate this bug. All I did was follow the tutorial. The tutor's deployment worked, mine did not.
This is package.json
:
{
"name": "forkify-app",
"version": "1.0.0",
"description": "",
"default": "index.html",
"scripts": {
"start": "parcel index.html --open",
"build": "parcel build index.html --dist-dir ./dist"
},
"repository": {
"type": "git",
"url": "git+.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": ";
},
"homepage": ";,
"devDependencies": {
"@parcel/transformer-sass": "^2.0.1",
"parcel": "^2.0.1"
},
"dependencies": {
"core-js": "^3.19.2",
"fractional": "^1.0.0",
"regenerator-runtime": "^0.13.9"
}
}
I can't find anything relevant online and that's why I've posted here.
I have published a git repo (https://github./GeorgeFlorian/Forkify-App) to Netlify (https://forkify-jorjelify.app/) after following an Udemy tutorial:
Everything works locally, but when I deploy it I get
Uncaught ReferenceError: Fraction is not defined
at View.js:96
Fraction
is not even inside View.js
module: https://github./GeorgeFlorian/Forkify-App/blob/main/src/js/views/View.js
It is inside another one: https://github./GeorgeFlorian/Forkify-App/blob/main/src/js/views/recipeView.js
I don't know how to recreate this bug. All I did was follow the tutorial. The tutor's deployment worked, mine did not.
This is package.json
:
{
"name": "forkify-app",
"version": "1.0.0",
"description": "",
"default": "index.html",
"scripts": {
"start": "parcel index.html --open",
"build": "parcel build index.html --dist-dir ./dist"
},
"repository": {
"type": "git",
"url": "git+https://github./GeorgeFlorian/Forkify-App.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github./GeorgeFlorian/Forkify-App/issues"
},
"homepage": "https://github./GeorgeFlorian/Forkify-App#readme",
"devDependencies": {
"@parcel/transformer-sass": "^2.0.1",
"parcel": "^2.0.1"
},
"dependencies": {
"core-js": "^3.19.2",
"fractional": "^1.0.0",
"regenerator-runtime": "^0.13.9"
}
}
I can't find anything relevant online and that's why I've posted here.
Share Improve this question asked Dec 1, 2021 at 20:36 George SloataGeorge Sloata 1651 gold badge2 silver badges12 bronze badges4 Answers
Reset to default 8I got the same error, did the same JS Udemy course by Jonas lol. I found out the problem has to do something with parcel hoisting. Insert --no-scope-hoist
in front of the build mand like this & try
parcel build index.html --no-scope-hoist
Use a different package Fracty instead of Fractional
For some reason, none of those 2 packages mentioned are working at this time. For those encountering the same issue, uninstall Fractional and deploy again. It will work, but another solution needs to be applied to cover for the uninstalled package
npm un Fractional
then
git add -A
git mit -m 'Removed Fractional'
then
git push origin master
Test and all app functions should be back to normal, as tested on local, but the fractional features that you'll have to replace.
I encountered the same issue and resolved it by switching to the Fracty
npm package instead of using fractional
as Jonas used in his tutorial.
The advantage of using Fracty is that it not only helped me deploy my site to Netlify without any issues, but it also fixed a problem I had with fractional, where the fractions weren't applied to newly created recipes. Fracty worked perfectly in both cases.