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.

Step: Using Bind Mounts fails

See original GitHub issue

When running the following docker command

docker run -dp 3000:3000 \
    -w /app -v "$(pwd):/app" \
    node:12-alpine \
    sh -c "yarn install && yarn run dev"

I get the following Error:

...
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/app/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/app/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/app/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/app/node_modules/which/which.js:80:29)
gyp ERR! stack     at /app/node_modules/which/which.js:89:16
gyp ERR! stack     at /app/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /app/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:168:21)
gyp ERR! System Linux 5.11.0-41-generic
gyp ERR! command "/usr/local/bin/node" "/app/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /app/node_modules/sqlite3
gyp ERR! node -v v12.22.7
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /app/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/app/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1022:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 5.11.0-41-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /app/node_modules/sqlite3
node-pre-gyp ERR! node -v v12.22.7
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /app/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/app/node_modules/sqlite3/lib/binding/napi-v3-linux-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)

I managed to solve this by simply using the formerly build docker image tagged as getting-started, which runs python etc. and changed the current command to:

docker run -dp 3000:3000 \
    -w /app -v "$(pwd):/app" \
    getting-started \
    sh -c "yarn install && yarn run dev"

I’m pretty new to docker, so I’m not sure about this, but could it be a valid option to use the formerly build image also for this tutorial step or is there another intention behind using the node:12-alpine image directly?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
Tobindekornecommented, Jan 21, 2022

I had this same problem on M1 Mac and was able to solve by just adding to the command that we run when starting the container. I ran:

docker run -dp 3000:3000 \
    -w /app -v "$(pwd):/app" \
    node:12-alpine \
    sh -c "apk add --no-cache python2 g++ make && yarn install && yarn run dev"

and this worked as well without the need to create a new image.

1reaction
ColemanDunncommented, Apr 26, 2022

Thanks, yes we’ve just merged a PR that adds this command to the guide. It’s happening on M1 machines or other ARM64 machines. Unfortunately on these machines the sqlite3 package needs the compiler and python installed to build the dependency.

@StefanScherer After seeing your comment I can see that this command has been added to the guide on localhost:80 after running docker run -d -p 80:80 docker/getting-started as per part 1 of the online guide as shown here: image

But it has NOT been added to the equivalent page for part 6 on the regular website. image

Is there any possibility that this can be added to the regular website? I am also on a MacBook Pro M1 Max and personally, this stopped me in my tracks and really hindered my progress. I came across many different pages before finally finding this solution and it could benefit others as well. Not to mention that Apple removed python 2 from the OS as of macOS Monterey 12.3 which was released in March so trying to debug this locally on a version newer than that won’t get you anywhere.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bind mounts - Docker Documentation
If you use --mount to bind-mount a file or directory that does not yet exist on the Docker host, Docker does not automatically...
Read more >
Persist data in a container app using volumes in VS Code
In this tutorial, you learn how to: Understand data across containers. Persist data using named volumes. Use bind mounts. View image layer.
Read more >
Solved: Bitbucket self-hosted runner failing: Bind mount f...
Status 500: {"message":"Bind mount failed: ... [2022-03-29 16:34:43,606] Completing step with result Result{status=ERROR, ...
Read more >
Bind mounts - Amazon Elastic Container Service
With bind mounts, a file or directory on a host, such as an Amazon EC2 instance or AWS Fargate, is mounted into a...
Read more >
Recreating docker bind-mount - Stack Overflow
If you bind-mount a non-existent file (on the host), docker will happily create a directory in its place and share it with the...
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