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.

Error: Please install sqlite3 package manually

See original GitHub issue

It looks like a very old issue but not I think so. Here https://github.com/kostysh/electron-sqlite-react a simple app scaffold with:

  • electron-forge@6.0.0-beta.28
  • electron@2.0.9
  • sqlite3@4.0.2
  • sequelize@4.38.1

Then I try to npm start I alwais get a error:

App threw an error during load
Error: Please install sqlite3 package manually

Of course, I have done npx electron-rebuild -f -w sqlite3. Also, I have built sqlite from sources but the result is the same.

My system env:

  • Ubuntu 18.04
  • node.js v10.7.0
  • npm v6.4.1

My forge.config.js:

const path = require('path');
const merge = require('webpack-merge');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const sharedModule = {
    rules: [
        {
            test: /\.js$/,
            exclude: /node_modules/,
            use: {
                loader: 'babel-loader',
                options: {
                    presets: [
                        [
                            '@babel/preset-env',
                            {
                                targets: {
                                    electron: '2.0.9'
                                }
                            }
                        ], 
                        '@babel/preset-react'
                    ]
                }
            }
        },
        {
            test: /\.(png|jpg|gif)$/,
            use: ['url-loader']
        }
    ]
};

module.exports = {
    electronRebuildConfig: {
        // force: true
    },
    plugins: [
        [
            '@electron-forge/plugin-webpack', {
                mainConfig: {
                    entry: {
                        index: [
                            '@babel/polyfill',
                            path.resolve(__dirname, 'src/index.js')
                        ]
                    },
                    module: sharedModule,
                    plugins: [
                        new CopyWebpackPlugin([
                            {
                                from: path.resolve(__dirname, 'src/assets'),
                                to: path.resolve(__dirname, '.webpack/assets')
                            }
                        ])
                    ],
                    output: {
                        filename: '[name].js'
                    }
                },
                renderer: {
                    config: {
                        module: merge.smart({
                            rules: [
                                {
                                    test: /\.css$/,
                                    use: ['style-loader', 'css-loader']
                                },
                                {
                                    test: /\.(svg)$/,
                                    use: ['svg-loader']
                                }
                            ]
                        }, sharedModule),
                        resolve: {
                            extensions: ['.js', '.json'],
                        }
                    },
                    prefixedEntries: process.env.NODE_ENV === 'production' ? [] : ['react-hot-loader/patch'],
                    entryPoints: [
                        {
                            html: path.resolve(__dirname, 'src/renderer/index.html'),
                            js: path.resolve(__dirname, 'src/renderer/index.js'),
                            name: 'main_window'
                        }
                    ]
                }
            }
        ]
    ],
    packagerConfig: {},
    makers: [
        {
            name: '@electron-forge/maker-squirrel',
            config: {
                name: 'pandora-market'
            }
        },
        {
            name: '@electron-forge/maker-zip',
            platforms: [
                'darwin'
            ]
        },
        {
            name: '@electron-forge/maker-deb',
            config: {}
        },
        {
            name: '@electron-forge/maker-rpm',
            config: {}
        }
    ],
    publishers: []
};

electron-forge start output with debug info:

> DEBUG=electron-forge:* npx electron-forge start

WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:async-ora Process Started: Checking your system +0ms
  electron-forge:check-system checking system, create ~/.skip-forge-system-check to stop doing this +0ms
  electron-forge:async-ora Process Succeeded: Checking your system -- after 161ms +161ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:async-ora Process Started: Locating Application +0ms
  electron-forge:project-resolver searching for project in: /home/[path-to-the-app]/elsqlite +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /home/[path-to-the-app]/elsqlite/package.json +4ms
  electron-forge:async-ora Process Succeeded: Locating Application -- after 5ms +5ms
  electron-forge:require-search searching [ '@electron-forge/plugin-webpack',
  '/home/[path-to-the-app]/elsqlite/@electron-forge/plugin-webpack',
  '/home/[path-to-the-app]/elsqlite/node_modules/@electron-forge/plugin-webpack' ] relative to /home/[path-to-the-app]/elsqlite +0ms
  electron-forge:require-search testing @electron-forge/plugin-webpack +2ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:plugin:webpack hooking process events +0ms
  electron-forge:async-ora Process Started: Preparing native dependencies +765ms
  electron-forge:async-ora Process Renamed: Preparing native dependencies  -->  Preparing native dependencies: 0 / 1 +226ms
  electron-forge:async-ora Process Renamed: Preparing native dependencies: 0 / 1  -->  Preparing native dependencies: 1 / 1 +3ms
  electron-forge:async-ora Process Succeeded: Preparing native dependencies: 1 / 1 -- after 229ms +0ms
  electron-forge:plugins plugin: "webpack" has taken control of the start command +0ms
  electron-forge:async-ora Process Started: Compiling Main Process Code +0ms
  electron-forge:async-ora Process Succeeded: Compiling Main Process Code -- after 4s +4s
  electron-forge:async-ora Process Started: Launch Dev Servers +1ms
  electron-forge:async-ora Process Succeeded: Launch Dev Servers -- after 30ms +30ms
  electron-forge:async-ora Process Started: Compiling Preload Scripts +0ms
  electron-forge:async-ora Process Succeeded: Compiling Preload Scripts -- after 1ms +1ms
  electron-forge:async-ora Process Started: Launching Application +4s
  electron-forge:async-ora Process Succeeded: Launching Application -- after 13ms +13ms


Webpack Output Available: http://localhost:9000

  electron-forge:plugin:webpack hooking electron process exit +4s
App threw an error during load
Error: Please install sqlite3 package manually
    at new ConnectionManager (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:114110:15)
    at new SqliteDialect (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:114491:30)
    at new Sequelize (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:123593:20)
    at Module../src/db.js (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:150060:12)
    at __webpack_require__ (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:21:30)
    at Module../src/index.js (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:150099:61)
    at __webpack_require__ (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:21:30)
    at Object.0 (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:150166:18)
    at __webpack_require__ (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:21:30)
    at /home/[path-to-the-app]/elsqlite/.webpack/main/index.js:85:18
    at Object.<anonymous> (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:88:10)
    at Object.<anonymous> (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:150415:3)
    at Module._compile (module.js:642:30)
    at Object.Module._extensions..js (module.js:653:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at loadApplicationPackage (/home/[path-to-the-app]/elsqlite/node_modules/electron/dist/resources/default_app.asar/main.js:287:12)
    at Object.<anonymous> (/home/[path-to-the-app]/elsqlite/node_modules/electron/dist/resources/default_app.asar/main.js:328:5)
    at Object.<anonymous> (/home/[path-to-the-app]/elsqlite/node_modules/electron/dist/resources/default_app.asar/main.js:365:3)
    at Module._compile (module.js:642:30)
    at Object.Module._extensions..js (module.js:653:10)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Please install sqlite3 package manually
    at new ConnectionManager (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:114110:15)
    at new SqliteDialect (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:114491:30)
    at new Sequelize (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:123593:20)
    at Module../src/db.js (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:150060:12)
    at __webpack_require__ (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:21:30)
    at Module../src/index.js (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:150099:61)
    at __webpack_require__ (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:21:30)
    at Object.0 (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:150166:18)
    at __webpack_require__ (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:21:30)
    at /home/[path-to-the-app]/elsqlite/.webpack/main/index.js:85:18
    at Object.<anonymous> (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:88:10)
    at Object.<anonymous> (/home/[path-to-the-app]/elsqlite/.webpack/main/index.js:150415:3)
    at Module._compile (module.js:642:30)
    at Object.Module._extensions..js (module.js:653:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at loadApplicationPackage (/home/[path-to-the-app]/elsqlite/node_modules/electron/dist/resources/default_app.asar/main.js:287:12)
    at Object.<anonymous> (/home/[path-to-the-app]/elsqlite/node_modules/electron/dist/resources/default_app.asar/main.js:328:5)
    at Object.<anonymous> (/home/[path-to-the-app]/elsqlite/node_modules/electron/dist/resources/default_app.asar/main.js:365:3)
    at Module._compile (module.js:642:30)
    at Object.Module._extensions..js (module.js:653:10)
webpack built 7fca1094a6ea0f988ecf in 1313ms
^C  electron-forge:plugin:webpack handling process exit with: { exit: true } +2s
undefined
  electron-forge:plugin:webpack handling process exit with: { cleanup: true } +2ms
  electron-forge:plugin:webpack cleaning webpack watcher +0ms
  electron-forge:plugin:webpack cleaning http server +14ms
  electron-forge:plugin:webpack stopping logger +0ms

Test case

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Analytics

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

github_iconTop GitHub Comments

11reactions
kostyshcommented, Sep 19, 2018

According to my previous comment I have found a solution. I have added sqlite3 module to the external config and thats solved the problem. For now, my mainConfig is looks like:

mainConfig: {
    entry: {
        index: [
            '@babel/polyfill',
            path.resolve(__dirname, 'src/index.js')
        ]
    },
    module: sharedModule,
    plugins: [
        new CopyWebpackPlugin([
            {
                from: path.resolve(__dirname, 'src/assets'),
                to: path.resolve(__dirname, '.webpack/assets')
            }
        ])
    ],
    output: {
        filename: '[name].js'
    },
    externals: ['sqlite3']
},

So, thats was not a error in the electron-forge and issue can be closed.

4reactions
ishwarrimalcommented, May 19, 2020

If anyone still facing issue, try using better-sqlite3 instead of sqlite3. Follow regular steps and it should work.

Better sqlite3 7.0.1 solves this issue of binding native module which existed earlier. Please have a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR: Please install sqlite3 package manually · Issue #11174
I initialized sequelize sequelize init and corrected config/config.json with data to connect to my sqlite db.
Read more >
Error: Please install sqlite3 package manually - Treehouse
Error : Please install sqlite3 package manually. In case someone gets this error. After following the instructions twice and getting stuck.
Read more >
ERROR: "Please install sqlite3 package manually" when I ...
First install sequelize-cli globally. sudo npm install -g sequelize-cli. Then use the following ...
Read more >
Error: please install sqlite3 package manually" node js REACT
https://imgur.com/7mee0AY I try, npm uninstall sqlite3 and install sqlite3, npm rebuild, delete folder node_modules and npm i + delete package-lock.json, ...
Read more >
Freshworks SDK (fdk) not getting installed throwing sqlite3 ...
Facing issues while installing the Freshdesk SDK (fdk), it asks to install sqlite3 package manually, upon installing it globally, ...
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