Electron sqlite3 package app module not found - node.js

When I run the packaged electron app for windows(which includes sqlite3), I get the following error:
Knex: run
$ npm install sqlite3 --save
Error: Cannot find module 'C:\Users\User\Desktop\Shoppinglist2-win32-ia32\resour
ces\app.asar\node_modules\sqlite3\lib\binding\electron-v2.0-win32-ia32\node_sqli
te3.node'
at Module._resolveFilename (module.js:543:15)
at Function.Module._resolveFilename (C:\Users\User\Desktop\Shoppinglist2-win
32-ia32\resources\electron.asar\common\reset-search-paths.js:35:12)
at Function.Module._load (module.js:473:25)
at Module.require (module.js:586:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\User\Desktop\Shoppinglist2-win32-ia32\resour
ces\app.asar\node_modules\sqlite3\lib\sqlite3.js:4:15)
at Object.<anonymous> (C:\Users\User\Desktop\Shoppinglist2-win32-ia32\resour
ces\app.asar\node_modules\sqlite3\lib\sqlite3.js:190: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 Module.require (module.js:586:17)
at require (internal/module.js:11:18)
at Client_SQLite3._driver (C:\Users\User\Desktop\Shoppinglist2-win32-ia32\re
sources\app.asar\node_modules\knex\lib\dialects\sqlite3\index.js:75:12)
at Client_SQLite3.initializeDriver (C:\Users\User\Desktop\Shoppinglist2-win3
2-ia32\resources\app.asar\node_modules\knex\lib\client.js:219:26)
If I package the app for Linux it workes fine.
PS: Sqlite3 is included as a normal dependency and if i execute the app by npm start it workes fine. And I took care of the rebuild process
Thank you :-)

Related

Can't deploy my node.js app anymore on ubuntu

An old app at work stoped working on an aws machine. I've been assigned the task, but I'm more of a Rails guy. And this is node.js using an old Sails. I tried a bunch of stuff and now even my npm seem broken. I get this error:
ubuntu#ip-172-31-5-52:~$ npm -v
internal/modules/cjs/loader.js:605
throw err;
^
Error: Cannot find module 'are-we-there-yet'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:659:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/log.js:2:16)
at Module._compile (internal/modules/cjs/loader.js:723:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)

Error: Cannot find module 'internal/linkedlist' in WebStorm

I have a script that runs fine when I run it in terminal with node, but using WebStorm I can't properly run it as it crashes on a dependency require line.
I've attempted to npm install internal/linkedList, I've also attempted to npm cache clean (as recommended in another post).
The full stack trace is:
Error: Cannot find module 'internal/linkedlist'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/harshagoli/Library/Preferences/WebStorm2017.2/javascript/nodejs/8.1.4/core-modules/timers.js:26:11)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)

npm throwing error about missing module '../'

I'm running a react-native app right now, and even though the simulation runs perfectly on iOS when I run react-native run-ios, if I run npm start to run the app on a physical device, npm throws the following error:
> Project#0.0.1 start /Users/zavtra/Development/App-RN
> node node_modules/react-native/local-cli/cli.js start
module.js:442
throw err;
^
Error: Cannot find module '../'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/zavtra/Development/App-RN/node_modules/.bin/which:2:13)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
How can a module be named ../? I didn't change anything in the modules and I can't figure out why this error is suddenly occurring. Is there something I have to install/uninstall for the server to work again?
I ran npm install as well and updated my npm/node. No dice.

Cannot find module 'xmlbuilder' when building ionic app

When i executing
ionic start myApp tabs
i am getting below error
Error: Cannot find module 'xmlbuilder'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:12:13)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/xml2js/lib/xml2js.js:436:4)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
node -v gives v4.4.1
npm -v gives 2.14.20
i have done npm install xmlbuilder
Please install xmlbuilder module to global environment:
npm install -g xmlbuilder

Weird Cloudfoundry error

I have a simple node app that I am trying to host on cloudfoundry. I am using the node module srand.
When I visit the url, I get this error.
Error: Cannot find module './build/default/srand.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/var/vcap/data/dea/apps/UnfoundedAccusations-0-8f4d453d8731dd95a14f10aeddc17eae/app/node_modules/srand/index.js:4:20)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
Recently cloudfoundry made some changes for Node.js modules support. Have a look at here http://blog.cloudfoundry.com/2012/12/19/recent-changes-in-node-js-modules-support/
You have probably installed the module globally, which is fine for local development but you need to deploy the application with the module.
Before deploying via vmc, run npm install in the project directory.

Resources