question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trouble setting up a working JS environment for the course

See original GitHub issue

First of all thanks for sharing this lovely course.

I was going to play around with the course today but I am having trouble setting up the JS requirements on my Mac (node 10, node 12, node 14) and an Ubuntu (node 12) docker image, I am a JS novice so that could be the problem.

I went down a rabbit hole trying to get sharp installed which led me to try and bump sharp up from sharp@0.21.3 based on https://github.com/gatsbyjs/gatsby/issues/13781 Next I played npm whack-a-mole with trying making sure all dependencies’ sharp version gets bumped which led to other dependencies needing to be changed.

Is there a way to resolve all these dependencies in the JS world? Python packaging seems like heaven compared to what I had to go through.

I have managed to create a working Dockerfile with all the updated packages where I can run gatsby in dev mode and run the python tests - I will create a PR to merge these.

— BELOW is my debugging process as a JS novice —

On both my Mac and the Ubuntu docker image following:

npm install -g gatsby-cli  # Install Gatsby globally
npm install                # Install dependencies

During npm install installing sharp@0.21.3 fails with an error like this:

> sharp@0.21.3 install /host/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.0/libvips-8.7.0-linux-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=12.16.3 runtime=node arch=x64 libc= platform=linux)
make: Entering directory '/host/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:27:0:
../src/common.h:78:20: error: 'Handle' is not a member of 'v8'
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
                    ^~~~~~
../src/common.h:78:37: error: expected primary-expression before '>' token
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
.
.
.

Then I used to hunt down dependencies using sharp and what version are coming through:

npm ls | grep -C 10 --color sharp

Then using npm-remote-ls looked for what the updated sharp version would be for example with gatsby-plugin-manifest:

npm-remote-ls gatsby-plugin-manifest@2.0.29 | grep sharp

Tried to harmonise the version bumps to use one version of sharp as multiple sharp versions seem to potentially cause challenges.

Finally I have tried to resolve all conflicts from the previous bumps. As a complete JS Novice I am not sure if my approach is sensible I will make a PR where you can review

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
swartchris8commented, May 17, 2020

Sure I will pull the config.env into the makefile. It is not a convention just a pattern I like to use. With just one env var it makes sense to pull it in.

0reactions
rongpenlcommented, Jul 22, 2021

Possibly related to node-gyp package. See https://github.com/nodejs/node-gyp/issues/1779.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling common JavaScript problems - MDN Web Docs
Now we'll look at common cross-browser JavaScript problems and how to fix them. This includes information on using browser dev tools to track ......
Read more >
JavaScript Tutorial – How to Set Up a Front End Development ...
To solve this problem, in this article I'm going to walk you through how to set up a front end project from scratch....
Read more >
Setting up your environment - JavaScript Tutorial - LinkedIn
With that installed, open your terminal application and navigate to the exercise files folder that contains the files for this course. We're going...
Read more >
Node Environment Variables: Process env Node
2. How can I see node environment variables? · 2. How can I see node environment variables? · 3. How can I set...
Read more >
Setting up the environment in Java - GeeksforGeeks
Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, etc.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found