Ask coding questions

← Back to all posts
Python Environment Variable for npm/gyp (in an imported Gatsby project)
noididntreadit

Code

I'm trying to import code from github, it's a Gatsby starter website: https://github.com/EmaSuriano/gatsby-starter-mate

Here's the imported version:
https://repl.it/@noididntreadit/gatsby-starter-mate

Issue

During the dependency loading I run into what seems to be a common gyp error (the full error report is roughly the same as what is stated at the 2 links below, and the exact wording is in yarn-error.log in my project):

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable \"python\", you can set the PYTHON env variable.

Troubleshooting

I found this error on github and StackOverflow, but how do I run npm commands and/or set an environment variable for Repl.it?

https://github.com/felixrieseberg/windows-build-tools/issues/56#issuecomment-308739624
https://stackoverflow.com/questions/15126050/running-python-on-windows-for-node-js-dependencies

I tried to add some random Python packages that came up in the search, but those didn't seem to change anything for me. From package.json:

I can see there that dotenv and envfile are dependencies, and they sound like they might allow me to fix the Python env variable issue, but how do I modify those dependencies?

Or should I be doing something else entirely?

Thanks,
Peter

We didn't quite get this working but I think it's on the right track with the answer thread selected.

Answered by a5rocks [earned 5 cycles]
View Answer
Voters
a5rocks
B0T
noididntreadit
Comments
hotnewtop
a5rocks

Well, this would be not a problem if repl allowed you to do anything with any lang in every repl type. However, there is only one repl type where that is allowed : polygott. So, just go to https://repl.it/languages/polygott, go into the console (ctrl+shift+p then search "shell"), git clone SOMETHING, and now in the makefile, replace run-project (or whatever) with node main.js (or whatever the filepath is), and now it should work.

noididntreadit

@a5rocks Thanks for the reply!

I got it to load all of the files with this in the Makefile, Ctrl+Shift+I was opening the Chrome developer console for me.

I'm struggling again with the node main.js part though. I think it should be node (src/pages/)index.js, but it could also be node (bin/)setup.js. However none of those are working. node src/pages/index.js gets the closest, and (I think) starts loading React as the first import before crapping out.

Does anything jump out as the issue here? That error seems to be too generic to search on.

https://repl.it/@noididntreadit/FromGitHubPolygott
This file cannot be displayed: https://storage.googleapis.com/replit/images/1557600682476_a10d8629dcb3f4386238753311b5b2af.pn

a5rocks

@noididntreadit wait oof meant ctrl+shift+p

OOOOF

but your way works anyway

Also: maybe you need to npm install?

noididntreadit

@a5rocks Oh yeah I guess it's not doing all of that for me when I run anymore, that makes sense then. I'll try that.

noididntreadit

@a5rocks That got me a little further. Eventually npm breaks:

Since it calls out all the versions I went into package.json to see what I should upgrade and noticed there is a "setup" option their to call the bin/setup.js, and that worked (using node ./bin/setup.js), so I guess enough installed for that.

That takes in some Contentful API keys and such, which works, but then tells me to use yarn develop (which I put on the next line of the Makefile), and that still breaks. This is the end of the setup.js run and then right into the yarn develop failure:

From there a tried a few different options (back to node ../../index.js, npm run develop, and "start" per package.json) but none of them worked.

This file cannot be displayed: https://storage.googleapis.com/replit/images/1557768579783_c27687d45e9a4ed2aea8ce26e43c76ae.pn

This was the best error from all of that:

I don't really care to have the Contentful stuff or probably even the things from Python. I just wanted to get the code running so it was easier to see what code matched up to what site features so I can pull/remix the good parts into my own projects. At this point I think I'll just try to do some of that blind and give up on this polygott run.

Thank you so much for the help!

a5rocks

@noididntreadit oof oh well... If you ever figure this out, mind making a tutorial for anyone else running into this issue? It would probably be useful to people who want to run this.

PS I recommend trying it on your own computer, and then learning it, and then maybe figuring out what went wrong. :p

noididntreadit

@a5rocks I don't have a local setup to build it in, repl is my only option at this point.

Looking into this more broadly I found https://www.gatsbyjs.org/docs/migrating-from-v1-to-v2/ which I think covers most of the problems with the imported codes in general. A lot of the imports don't work because the Repl default setup is for Gatsby v1.

I still couldn't get the 'sharp' components to work, which knocks out most of the new plugin stuff (-filesystem, -offline, -manifest), but I was able to import from https://github.com/gatsbyjs/gatsby-starter-default/ and eventually delete enough parts that it will compile.

So now there is a semi-v2 starter: https://repl.it/@noididntreadit/gatsby-starter-default (although it doesn't have the newer features included/working), and I'm going to submit it as a template.

Thanks,
Peter

CarterGerald

Microsoft advancement is a perplexing idea. In 2019, at Microsoft's Ignite undertaking engineer meeting in Florida, applications Satya Nadella, the Microsoft CEO, communicated his desire for everyone to have the option to grow in any case the reality whether or not they can code. This basically sends the possibility that Microsoft Development isn't tied in with having the option to create from the starting point, yet rather about the ability to improve and give the most working arrangement in the given conditions. Microsoft Power Platform will summarize the thought since the Power applications empower the advancement of applications and projects to be effectively performed and run on different OS without the execution of any mind boggling code.

Microsoft Dynamics designers should have the option to upgrade the item that is as of now there present, the manner in which it completely fits the client base necessities. This carries us to where, while employing a tech ability for the position, one should focus on both hard and delicate abilities, since not just the innovation side is significant. Getting the particulars and interpreting the customer's vision of the result procures a similar basic worth. Innovation is for business, and business is for individuals. Human nuts and bolts won't ever be tossed out of the situation, read more here https://www.bettertechtips.com/programming/10-things-to-know-when-considering-dynamics-365-developer-for-hire/