Enmap is a wrapper around better-sqlite3, which requires to be built directly on your system. As such, you need to install pre-requisites first. Please follow these instructions to the letter. If it's not written here, you probably shouldn't do it unless you know why you're doing it.
How to install the pre-requisites depends on your operating system, so see below for instructions:
On Windows, two things are required to install better-sqlite3. Python, and the Visual Studio C++ Build Tools. They are required for any module that is built on the system, which includes sqlite.
To install the necessary prerequisites on Windows, the easiest is to simply run the following commands separately, under an administrative command prompt or powershell:
// First run:npm i -g --add-python-to-path --vs2015 --production windows-build-tools// Then run:npm i -g node-[email protected]
It's very important that this be run in the administrative prompt, and not a regular one.
Once the windows-build-tools are installed (this might take quite some time, depending on your internet connection), close all open command prompts, powershell windows, and editors with a built-in console/prompt. Otherwise, the next command will not work.
On Linux, the pre-requisites are much simpler in a way. A lot of modern systems (such as Ubuntu, since 16.04) already come with python 2.7 pre-installed. For some other systems, you might have to fiddle with it to either get python 2.7 installed, or to install both 2.7 and 3.x simultaneously. Google will be your friend.
As for the C++ build tools, that's installed using the simple command:
sudo apt-get install build-essential for most debian-based systems. For others, look towards your package manager and specificall "GCC build tools". Your mileage may vary but hey, you're using Linux, you should know this stuff.
As of writing this page, MacOS versions seem to all come pre-built with Python 2.7 on the system. You will, however, need the C++ build tools.
Once XCode is installed, go to Preferences, Downloads, and install the Command Line Tools.
Once installed, you're ready to continue.
Once those pre-requisites are installed (if they're not, scroll up, and follow the instructions), and you've closed all open command prompts, open a new, normal (not-admin) command prompt or terminal in your project, then install Enmap using the following command:
npm i enmap
This will take a few minutes, as it needs to build better-sqlite3 from source code, and then install enmap itself. Note that "a few minutes" can be 1 or 30 minutes, it really depends on your hardware and configuration.
If you get any errors, please see the Troubleshooting Guide. If the guide doesn't help, join the Discord (link at the top of this page).