e-snyder-portfolio.netlify.app
eriksnyder.dev
This is for a class assignment that I have due soon and I would really appreciate some help because I am stuck.
I have a JS function that points certain images to the html via a setAttribute method.
The following is an abbreviated version of the function:
HTML:
JS:
const projImg = document.getElementById(“proj-img”);
const projDesc = document.getElementById(“proj-desc”);
const pageArr = [
{
projectId: “1”,
projImg: “…/src/images/orange.png”,
projectDesc: Project One
,
},
{
projectId: “2”,
projImg: “…/src/images/placeholder.png”,
projectDesc: Project Two
,
}
]
let id
function showPage(n) {
let dataIndex = pageArr[n- 1];
projImg.setAttribute(“src”, dataIndex.projImg);
projDesc.innerHTML = dataIndex.projectDesc;
}
showPage(id)
All of this works just fine in local environment, but the images (6kb file size) do not load when the site is deployed. The project descriptions(projDesc) load just fine in deployed version so the problem is isolated to the images only. The rest of the function works.
I am using Parcel v2. The site builds properly in local environment.
I thought this might be a problem with the image file path so I tried a few different options but none of them worked.
All other images on the site work.
I found this discussion:
The above discussion is suggesting to “set the NODE_VERSION env var to the exact same version you are using locally.”
The link to the instructions on how to do this are unclear to me.
This is what I have for Environment Variables:
Key: NODE_VERSION, Value: 18.8.0
Do I need to re-deploy the site now? What is the next step? Is there something else that could be causing the problem?
Please let me know if I need to provide any additional information.
Thanks,