Using npm modules with electron and webpack? - sqlite

I want to use sqlite3 with this boilerplate:
https://github.com/bradstewart/electron-boilerplate-vue
I've tried a lot of ways getting require('sqlite3'), to work, but it keeps failing with the error:
Uncaught Error: Cannot find module 'sqlite3'
global.require() did not work
adding it to the webpack.ExternalsPlugin in builds/webpack.base.conf.js did not help
How can I solve this?

This should be able to help you: How to use sqlite3 module with electron?
Basically:
Install electron-rebuild: npm i electron-rebuild --save-dev
Launch electron-rebuild ./node_modules/.bin/electron-rebuild (or
.\node_modules\.bin\electron-rebuild.cmd on windows)
Go to "node_modules/sqlite3/lib/binding/" and rename the folder
"electron-v0.36-darwin-x64" to "node-v47-darwin-x64"

Related

ESLint couldn't find the config "google" to extend from. Please check that the name of the config is correct

I'm trying to deploy a cloud function on firebase. I'm successfully logged into firebase CLI from osx terminal. When I go to deploy it kicks back this error.
Oops! Something went wrong! :(
ESLint: 7.19.0
ESLint couldn't find the config "google" to extend from. Please check that the name of the config is correct.
it's because you didn't do the install
Would you like to install them now with npm? ยท No / Yes
you can try again configuring json .eslint or you can do it this way
npm install eslint-config-google --save-dev
As explained here: https://eslint.org/docs/user-guide/configuring/configuration-files#using-a-configuration-from-a-plugin
The extends property value can consist of:
plugin:
the package name (from which you can omit the prefix, for example, react is short for eslint-plugin-react)
/
the configuration name (for example, recommended)
Meaning, if you extend your config using the google plugin like this in your .eslintrc.yml:
extends:
- google
you have to install it doing:
npm install eslint-config-google --save-dev
I had the same issue, While trying to debug my error I happen to make some changes in the below code, reverting it back to this way removed the error
Please check in your .eslintrc.js ,if the below code is there or not
extends: ["eslint:recommended", "google"],
Most likely you do not have eslint installed so try to install it by running this command:
npm install eslint-config-eslint --save-dev
After making sure that ESLint is installed, you just need to initialize it by running:
eslint --init
I had this issue and resolved mine running this:
npm install eslint-config-eslint --save-dev
Most likely you didn't have eslint-config-google installed.
Once installed try running ESLint again.

Warning: StringMap expected string key Use --force to continue

grunt build command failed with following results
Please help me....
NOTE:
ngAnnotate:dist reading happened but after that writing is not happening...
bower minification is working. controllers,services js files unable to ngAnnotate
None of controller have any ES6 features (no arrow funtion ==>, no Let,const keywords used to declare)
my package.json file has below modules
I was using "grunt-ng-annotate": "1.0.1" and got the same error. I tried to upgrade but it didn't work.
Since I needed a quick fix, I had to downgrade to 0.10.0 and now it's working fine.
I removed the current version: npm uninstall grunt-ng-annotate --save-dev
And installed the older one: npm install grunt-ng-annotate#0.10.0 --save-dev
I hope it helps!

using flag-icon-css (npm package) with meteor

I'm trying to use the npm package flag-icon-css with meteor.
I'm using sass to modify the icons path as follows:
$flag-icon-css-path: '/npm/node_modules/flag-icon-css/flags';
$flag-icon-rect-path: '/4x3';
$flag-icon-square-path: '/1x1';
#import '{}/node_modules/flag-icon-css/sass/flag-icon.scss';
but I'm stuck as i don't understand what is the correct path for the variable $flag-icon-css-path .
the question is simple : how can I access files that are in a npm package ? what is the correct path ? Do I need to export them all explicitly or something similar ?
It turns out that files from npm packages are not directly visible to the client. A solution should be to wrap the npm package in a meteor package and export what is needed to the client explicitly. In this case the solution is to use an already made package for this npm module : meteor add jss:flag-icon
NPM are packages that should be installed. It would then be able to directly adress it:
https://docs.npmjs.com/cli/install
Go in the folder using the prompt, and execute:
npm install

How import npm module 'mapbox-gl' in meteor 1.3

The npm module mapbox-gl failed at import in Meteor 1.3.
This is how the import looks like:
import mapboxgl from 'mapbox-gl'
The error in the browser console:
Cannot find module 'gl'
Is it a problem of Meteor's packager?
Can this package only be used through Browserify?
I am also interested in solving this baby. Copied from the mapbox-gl repo...
Alternatively, you can npm install mapbox-gl and use it as a bundled dependency with browserify.
It seems like it may depend on browserify? Why mapbox!! If I come up with a solution will post here.. Until then may God have mercy on our souls c:
update:: it is on!
mapbox error of d00m
update2:: the require statements inside mapboxgl.js are causing the errors.. My previous console error stemmed from not having the npm 'gl' package loaded before mapbox.
Any ideas how to debrowserify an npm package??
This is a known issue and there is no solution at the moment. You can still include mapbox-gl with a script tag:
<script src='https://api.mapbox.com/mapbox-gl-js/v0.22.1/mapbox-gl.js'></script>

npm: "Error: invalid version: 1.0" while installing grunt plugins

While yesterday all works fine, today i am getting the printed error below, when i try to install a grunt plugin, wether it is a official grunt contrib or vendor plugin.
I am running grunt v0.4, node v0.8.20 and npm v1.2.11, System X 10.8.2.
npm install grunt-<plugin>-<name> --save-dev
npm ERR! Error: invalid version: 1.0
npm ERR! at validVersion (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:590:40)
npm ERR! at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:342:23)
...
What suprises me is that also official grunt contrib plugins (grunt-contrib-xxx) fails to install altough i expect it has a proper semver version syntax. npm-debug.log shows nothing additional to the verbose output in the console.
Any hints are appreciated.
Thx in advance
felic
Sorry for replying this late.
I am new to the grunt/nodejs stuff, so I was a bit confused and it took a while to understand what's wrong: I updated grunt to 0.4.~ at that point without editing the related project package.json to reflect the correct grunt versioning ("1.0.0" instead of "0.1.0"). Thanks for your help.
Modify package.json to
"devDependencies" : {
"grunt" : "latest"
}
Now run
sudo npm install
This installs latest grunt.
[Note : Add required dependencies to object and the command will install it all on run]
since grunt 0.4 is aimed at the v1 of node maybe the plugin you're trying to install asks for a 1.0 version of node, try to read the package.js of the plugins yo're trying to install.
as glortho asked, you could tell us explicitely what plugin causes the problem

Resources