Ghost-CLI: Cannot find module '[...]/node_sqlite3.node'
Bug Report
Summary
Attempting to ghost install --db=sqlite3 into what I’ll call a staging server. It’s a fresh install of Ubuntu 16.04 LTS; no domain associated – I’m using the IP Address as the url. On the server, I’ve only installed updates, node, and build-essentials on it. Very sparse. (I also updated npm). Towards the end of the install I get the following:
[...]
? Do you wish to set up Systemd? No
ℹ Setting up Systemd [skipped]
Running sudo command: -E -u ghost /usr/lib/node_modules/ghost-cli/node_modules/.bin/knex-migrator-migrate --init --mgpath /home/frank01/beta02/current
Knex: run
$ npm install sqlite3 --save
Error: Cannot find module '/usr/lib/node_modules/ghost-cli/node_modules/sqlite3/lib/binding/node-v48-linux-x64/node_sqlite3.node'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/ghost-cli/node_modules/sqlite3/lib/sqlite3.js:4:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Client_SQLite3._driver (/usr/lib/node_modules/ghost-cli/node_modules/knex/lib/dialects/sqlite3/index.js:75:12)
at Client_SQLite3.initializeDriver (/usr/lib/node_modules/ghost-cli/node_modules/knex/lib/client.js:219:26)
at Client_SQLite3.Client (/usr/lib/node_modules/ghost-cli/node_modules/knex/lib/client.js:113:10)
at new Client_SQLite3 (/usr/lib/node_modules/ghost-cli/node_modules/knex/lib/dialects/sqlite3/index.js:58:20)
at Knex (/usr/lib/node_modules/ghost-cli/node_modules/knex/lib/index.js:60:34)
at Object.connect (/usr/lib/node_modules/ghost-cli/node_modules/knex-migrator/lib/database.js:24:12)
at KnexMigrator.init (/usr/lib/node_modules/ghost-cli/node_modules/knex-migrator/lib/index.js:71:32)
at KnexMigrator.migrate (/usr/lib/node_modules/ghost-cli/node_modules/knex-migrator/lib/index.js:160:21)
at /usr/lib/node_modules/ghost-cli/node_modules/knex-migrator/bin/knex-migrator-migrate:26:29
at tryCatcher (/usr/lib/node_modules/ghost-cli/node_modules/bluebird/js/release/util.js:16:23)
✖ Running database migrations
An error occurred.
Message: 'Command failed: /bin/sh -c sudo -E -u ghost /usr/lib/node_modules/ghost-cli/node_modules/.bin/knex-migrator-migrate --init --mgpath /home/frank01/beta02/current
'
Debug Information:
Node Version: v6.11.2
Ghost-CLI Version: 1.0.3
Environment: production
Command: 'ghost install --db=sqlite3'
Additional log info available in: /home/frank01/.ghost/logs/ghost-cli-debug-2017-08-12T12_38_04_426Z.log
Steps to Reproduce (for a bug report)
- Create Ubuntu 16.04 LTS server (note: I was ssh’d in as a non-root user who has sudo access)
apt update&&apt upgrade- install Node via the Nodejs PPA &
build-essentials npm install -g npm&&npm install -g ghost-clicd ~&&mkdir beta01&&cd beta01ghost install --db=sqlite3
Technical detail
Debug Information:
Node Version: v6.11.2
Ghost-CLI Version: 1.0.3
Environment: production
Command: 'ghost install --db=sqlite3'
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (5 by maintainers)
I bumped into this issue as well since I start using ghost-cli migrating from ghost v0.7 Thanks @FrankV01 for all the information but I found out it’s not related to permission
I followed the solution you gave, and here is the result:
and I have checked all permission is set properly, but error was still there
so later I tried
cd ~/.npm-global/lib/node_modules/ghost-cliand runnpm install sqlite3then it’s solvedso I think the root cause is ghost cli won’t install sqlite3 globally even if
--db sqlite3parameter is givensorry I haven’t had time to check source code, so FYI @ErisDS, also thanks for all the awesome works
I’m having the same issue on
Debug Information: Node Version: v14.15.1 Ghost-CLI Version: 1.15.2 Environment: development Command: ‘ghost install local’ Platform: mac
@ddhp I love you.
cd `npm root -g`/ghost-cli && [sudo] npm install sqlite3Been trying every other fix under the sun for hours.Knex: run $ npm install sqlite3 --save Error: Cannot find module ‘F:\UpdateALT5\althingscustomerapp\AlThingsCustomer\node_modules\sqlite3\lib\binding\electron-v2.0-win32-x64\node_sqlite3.node’
Gonna close this for now as it should have been fixed by #505. If you run into the same issue with Ghost-CLI 1.3.0 - comment and we can reopen this 😃