<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>Q0JKD48B1117QG62</RequestId>
<HostId>0tR6ildiySR62EjZI4DwfeVbxSFIOClQUiIyMCySpd/lficx42uEJ2YU94GtQQvMnF4EENuWH/0=</HostId>
</Error>
I'n not entirely sure how to fix this because I'm not very experienced with Node.js/NPM and installing modules, however I do need node-sqlite3
specifically version 4.2.0
because one of my VSCode extensions relies on it. I have found the github repo of node-sqlite
and the 4.2.0
source code. Is there any way to fix this or compile the module from source? Maybe could it be because it's not supported on my node version/os? I had this working before so I'm not sure.
I'm on a MacBook Air M1 (ARM) running node version v16.3.0 and npm version v7.16.0.
–
–
–
The other answer is not helpful in my case. Also, I found that simply using yarn
instead of npm
solves the issues mentioned by the other answer.
However, that answer does not address the main issue:
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-*******.tar.gz
node-pre-gyp WARN Pre-built binaries not found
TL;DR
For me, upgrading to latest sqlite3
(e.g. via yarn add "sqlite3@^5"
(NOTE: this command does not work properly in powershell)) fixes this issue. The reason for that is: it finds the pre-built binaries for this version just fine.
If you (absolutely) NEED to use an older version, you will have to make sure, the local compilation succeeds, as explained below.
In addition to that, you also want to make sure, you have a somewhat recent version of node
installed, because often times, pre-built binaries are commonly not provided for out-of-date Node versions (check node -v
; recommendation: use volta to manage your node version).
Warning: Of course, those pre-built binaries might also be removed by the package author in the near fututure. Hopefully, they will at least replace them with a newer version, and not just take them offline entirely.
Explanation
The error message above indicates that gyp
was not able to download the system-specific pre-built binaries (which is very different from the npm
package). Because it cannot find the pre-built binaries, it would try to compile them locally, which is always messy and can easily go wrong.
Q: Why can it not find the pre-built binaries?
A: Pre-built binaries are not so easy to manage because you need a lot more different versions of them than just the version of the npm
package they are for. Usually, you need one for each major version of the npm
package + version of node + operating system + instruction set architecture (e.g. ARM 32bit vs. x86 64bit etc.). It appears that, for some reason, Mapbox decided not to store those pre-built binaries for the long haul. I am sure they were there in the past, but for version 4.2.0 (and possibly many other versions), they are gone now.
They might only keep all those different binaries for the latest major version of their npm
package and wipe old versions to save storage space. I have not found any documentation on that on their repo.
Q: What happens if it cannot download the pre-built binaries?
A: Things get very messy. Instead of a short download, it tries to compile them on your system, involving a complex labyrinth of system-level dependencies. For example:
In case of the OP, that compilation failed due to:
gyp: No Xcode or CLT version detected!
In my case, it failed because (on Windows), I did not have VS 2017
(nor its redistributables) installed.
In general, local compilation firstly requires node-gyp
to play along, and then you also need python
and a system-specific C++ compiler. If you Google a little, you will find many stories of people succeeding (and failing) to get such local compilation to work. It is possible to aim for local compilation, but getting the pre-built binaries makes things a lot easier.
–
–
–
And since you didn't tell us wich version of node you are using it maybe related to not using a correct version of node it mentioned here that node-sqlite3
v4.2.0 works with :
Node.js v4.x, v6.x, v8.x, v10.x, v11.x, v12.x and v13.x.
so you may consider using the correct version of nodejs
Alternatively
If you're trying to install node-sqlite3 v4.2.0
manually from the source code. it's actually possible as mentioned here on the npm docs. Just make sure you are downloading the tarball file not the zip file one, in your case it should be this one
Move the tarball where it should be, then simply run the following :
npm install node-sqlite3-4.2.0.tar.gz
Or even simpler :
npm install https://github.com/mapbox/node-sqlite3/archive/refs/tags/v4.2.0.tar.gz
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.