sqlite3 database opening in Electron - electron

I have no problems in importing sql3 in my Electron-React-Typescript-Webpack app:
import sqlite3 from 'sqlite3';
But when I add these lines in main.ts :
const sql3_cb = () => {
console.log("Welcome to sql3");
}
app.on('ready', async () => {
createMainWindow();
const infopiecesSqliteDb = new sqlite3.database(
path.join(app.getPath('userData'), '/infopiecessql3db'),
sql3_cb,
);
}
when running the app I get the following errors (complete backtrace):
(base) marco#pc01:~/webMatters/electronMatters/Raphy-Template$ yarn
start
yarn run v1.22.5
$ yarn run build && electron ./dist/main/main.js
$ npx webpack --config ./webpack.config.js
asset main.js 4.95 MiB [compared for emit] (name: main)
orphan modules 263 KiB [orphan] 138 modules
runtime modules 1.06 KiB 6 modules
javascript modules 3.6 MiB
cacheable modules 3.59 MiB
modules by path ./node_modules/ 3.58 MiB 660 modules
modules by path ./src/ 13.3 KiB 3 modules
json modules 374 KiB
modules by path ./node_modules/har-schema/lib/*.json 6.93 KiB 18
modules
modules by path ./node_modules/iconv-lite/encodings/tables/*.json
86.7 KiB 8 modules
modules by path ./node_modules/node-pre-gyp/ 16.8 KiB 3 modules
modules by path ./node_modules/ajv/lib/refs/*.json 5.58 KiB 3
modules
4 modules
WARNING in ./node_modules/node-pre-gyp/lib/pre-binding.js 20:22-48
Critical dependency: the request of a dependency is an expression
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 42:0-44
# ./node_modules/sqlite3/lib/sqlite3-binding.js 1:13-36
# ./node_modules/sqlite3/lib/sqlite3.js 2:14-45
# ./src/main/main.ts 35:16-34
WARNING in ./node_modules/node-pre-gyp/lib/util/compile.js 39:27-49
Module not found: Error: Can't resolve 'npm' in '/home/marco
/webMatters/electronMatters/Raphy-Template/node_modules/node-pre-
gyp/lib/util'
# ./node_modules/node-pre-gyp/lib/ sync ^\.\/.*$ ./util/compile.js
./util/compile
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 52:13-36 184:38-55
# ./node_modules/sqlite3/lib/sqlite3-binding.js 1:13-36
# ./node_modules/sqlite3/lib/sqlite3.js 2:14-45
# ./src/main/main.ts 35:16-34
WARNING in ./node_modules/node-pre-gyp/lib/util/versioning.js 17:20-67
Critical dependency: the request of a dependency is an expression
# ./node_modules/node-pre-gyp/lib/ sync ^\.\/.*$ ./util/versioning.js
./util/versioning
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 52:13-36 184:38-55
# ./node_modules/sqlite3/lib/sqlite3-binding.js 1:13-36
# ./node_modules/sqlite3/lib/sqlite3.js 2:14-45
# ./src/main/main.ts 35:16-34
WARNING in ./node_modules/sqlite3/lib/sqlite3-binding.js 4:14-35
Critical dependency: the request of a dependency is an expression
# ./node_modules/sqlite3/lib/sqlite3.js 2:14-45
# ./src/main/main.ts 35:16-34
4 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show
it.
ERROR in ./node_modules/node-gyp/lib/Find-VisualStudio.cs 9:6
Module parse failed: Unexpected token (9:6)
You may need an appropriate loader to handle this file type, currently
no loaders are configured to process this file. See
https://webpack.js.org/concepts#loaders
| // This script needs to be compatible with PowerShell v2 to run on
Windows 2008R2 and Windows 7.
|
> using System;
| using System.Text;
| using System.Runtime.InteropServices;
# ./node_modules/node-gyp/lib/ sync ^\.\/.*$ ./Find-VisualStudio.cs
# ./node_modules/node-gyp/lib/node-gyp.js 41:13-36 190:36-53
# ./node_modules/node-pre-gyp/lib/util/compile.js 29:28-55
# ./node_modules/node-pre-gyp/lib/ sync ^\.\/.*$ ./util/compile.js
./util/compile
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 52:13-36 184:38-55
# ./node_modules/sqlite3/lib/sqlite3-binding.js 1:13-36
# ./node_modules/sqlite3/lib/sqlite3.js 2:14-45
# ./src/main/main.ts 35:16-34
ERROR in ./node_modules/node-pre-gyp/lib/info.js 14:14-32
Module not found: Error: Can't resolve 'aws-sdk' in '/home/marco
/webMatters/electronMatters/Raphy-Template/node_modules/node-pre-
gyp/lib'
# ./node_modules/node-pre-gyp/lib/ sync ^\.\/.*$ ./info.js ./info
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 52:13-36 184:38-55
# ./node_modules/sqlite3/lib/sqlite3-binding.js 1:13-36
# ./node_modules/sqlite3/lib/sqlite3.js 2:14-45
# ./src/main/main.ts 35:16-34
ERROR in ./node_modules/node-pre-gyp/lib/publish.js 18:14-32
Module not found: Error: Can't resolve 'aws-sdk' in '/home/marco
/webMatters/electronMatters/Raphy-Template/node_modules/node-pre-
gyp/lib'
# ./node_modules/node-pre-gyp/lib/ sync ^\.\/.*$ ./publish.js
./publish
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 52:13-36 184:38-55
# ./node_modules/sqlite3/lib/sqlite3-binding.js 1:13-36
# ./node_modules/sqlite3/lib/sqlite3.js 2:14-45
# ./src/main/main.ts 35:16-34
ERROR in ./node_modules/node-pre-gyp/lib/unpublish.js 16:14-32
Module not found: Error: Can't resolve 'aws-sdk' in '/home/marco
/webMatters/electronMatters/Raphy-Template/node_modules/node-pre-
gyp/lib'
# ./node_modules/node-pre-gyp/lib/ sync ^\.\/.*$ ./unpublish.js
./unpublish
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 52:13-36 184:38-55
# ./node_modules/sqlite3/lib/sqlite3-binding.js 1:13-36
# ./node_modules/sqlite3/lib/sqlite3.js 2:14-45
# ./src/main/main.ts 35:16-34
ERROR in ./node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html
1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently
no loaders are configured to process this file. See
https://webpack.js.org/concepts#loaders
> <!doctype html>
| <html>
| <head>
# ./node_modules/node-pre-gyp/lib/ sync ^\.\/.*$ ./util/nw-pre-
gyp/index.html
# ./node_modules/node-pre-gyp/lib/node-pre-gyp.js 52:13-36 184:38-55
# ./node_modules/sqlite3/lib/sqlite3-binding.js 1:13-36
# ./node_modules/sqlite3/lib/sqlite3.js 2:14-45
# ./src/main/main.ts 35:16-34
3 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show
it.
webpack 5.31.2 compiled with 5 errors and 4 warnings in 12546 ms
assets by path lib/pdfjs-dist/web/ 4.55 MiB 341 assets
assets by path assets/ 1.4 MiB
assets by path assets/css/ 1.23 MiB 22 assets
assets by path assets/pics/ 170 KiB 9 assets
assets by path *.js 11.5 MiB 7 assets
assets by path lib/pdfjs-dist/build/ 6.3 MiB
assets by path lib/pdfjs-dist/build/*.map 4 MiB 3 assets
assets by path lib/pdfjs-dist/build/*.js 2.3 MiB 3 assets
assets by path *.html 28 KiB 5 assets
asset lib/pdfjs-dist/LICENSE 9.94 KiB [compared for emit] [from:
src/lib/pdfjs-dist/LICENSE] [copied]
asset lib/infopiecemgr.js 2.77 KiB [compared for emit] [from: src/lib
/infopiecemgr.js] [copied]
orphan modules 35.2 KiB [orphan] 118 modules
runtime modules 7.32 KiB 32 modules
modules by path ./node_modules/ 3.38 MiB 850 modules
modules by path ./src/ 132 KiB
modules by path ./src/app/ 55.9 KiB 16 modules
modules by path ./src/app_A/ 24.8 KiB 4 modules
modules by path ./src/app_B/ 24.8 KiB 4 modules
modules by path ./src/store/*.ts 3.5 KiB
./src/store/redux_hooks.ts 556 bytes [built] [code generated]
./src/store/store.ts 2.96 KiB [built] [code generated]
modules by path ./src/assets/css/*.css 21 KiB
./src/assets/css/global.css 339 bytes [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/assets/css/global.css
20.7 KiB [built] [code generated]
./src/reducers/infopiece/infopieceSlice.ts 1.98 KiB [built] [code
generated]
webpack 5.31.2 compiled successfully in 12552 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about
this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about
this command.
It looks like the errors are related to node-pre-gyp and / or webpack configuration.
But I do not understand how to fix them.
How to use sqlite3 in an Electron app?
(node:2679) UnhandledPromiseRejectionWarning: TypeError:
sqlite3_1.default.database is not a constructor
at App.<anonymous> (/home/marco/webMatters/electronMatters/Raphy-
Template/dist/main/main.js:60:32)
at App.emit (events.js:315:20)
(Use `electron --trace-warnings ...` to show where the warning was
created)
(node:2679) UnhandledPromiseRejectionWarning: Unhandled promise
rejection. This error originated either by throwing inside of an async
function without a catch block, or by rejecting a promise which was
not handled with .catch(). To terminate the node process on unhandled
promise rejection, use the CLI flag `--unhandled-rejections=strict`
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
(rejection id: 1)
(node:2679) [DEP0018] DeprecationWarning: Unhandled promise rejections
are deprecated. In the future, promise rejections that are not handled
will terminate the Node.js pro

Related

Rails precompile error: syntax Error at line: 1, column 38 for bootstrap import

When running: rake assets:precompile RUBY_ENV=production or when it automatically precompiles for deployment it gets this error message:
/usr/share/rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/net/protocol.rb:66: warning: already initialized constant Net::ProtocRetryError
/home/tbtonner/.rvm/gems/ruby-2.7.4/gems/net-protocol-0.1.3/lib/net/protocol.rb:68: warning: previous definition of ProtocRetryError was here
/usr/share/rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/net/protocol.rb:206: warning: already initialized constant Net::BufferedIO::BUFSIZE
/home/tbtonner/.rvm/gems/ruby-2.7.4/gems/net-protocol-0.1.3/lib/net/protocol.rb:208: warning: previous definition of BUFSIZE was here
/usr/share/rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0/net/protocol.rb:503: warning: already initialized constant Net::NetPrivate::Socket
/home/tbtonner/.rvm/gems/ruby-2.7.4/gems/net-protocol-0.1.3/lib/net/protocol.rb:504: warning: previous definition of Socket was here
Compiling...
Compilation failed:
Hash: 0d1853ed830e6c3e5bae
Version: webpack 4.46.0
Time: 3670ms
Built at: 08/22/2022 4:30:23 PM
3 assets
Entrypoint application = js/application-c19864950abec08bba5f.js js/application-c19864950abec08bba5f.js.map
[8] ./node_modules/#popperjs/core/lib/dom-utils/listScrollParents.js + 2 modules 1.84 KiB {0} [built]
| 3 modules
[13] ./node_modules/#popperjs/core/lib/dom-utils/getCompositeRect.js + 5 modules 2.41 KiB {0} [built]
| 6 modules
[14] ./node_modules/#popperjs/core/lib/dom-utils/getCommonOffsetParent.js + 2 modules 2.74 KiB {0} [built]
| 3 modules
[15] ./node_modules/#popperjs/core/lib/utils/validateModifiers.js + 1 modules 3.43 KiB {0} [built]
| 2 modules
[16] ./node_modules/#popperjs/core/lib/dom-utils/addClientRectMargins.js + 1 modules 826 bytes {0} [built]
| 2 modules
[17] multi ./app/frontend/packs/application.js ./app/frontend/packs/application.scss 40 bytes {0} [built]
[18] ./app/frontend/packs/application.scss 664 bytes {0} [built]
[20] ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/frontend/packs/application.scss 1.9 KiB {0} [built] [failed] [1 error]
[21] ./app/frontend/packs/application.js + 12 modules 198 KiB {0} [built]
| ./app/frontend/packs/application.js 899 bytes [built]
| ./app/frontend/js/bootstrap_js_files.js 402 bytes [built]
| + 11 hidden modules
+ 13 hidden modules
ERROR in ./app/frontend/packs/application.scss (./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/frontend/packs/application.scss)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
ParserError: Syntax Error at line: 1, column 38
at /home/tbtonner/woodvilla/app/frontend/packs/application.scss:6:67385
at Parser.error (/home/tbtonner/woodvilla/node_modules/postcss-values-parser/lib/parser.js:127:11)
at Parser.operator (/home/tbtonner/woodvilla/node_modules/postcss-values-parser/lib/parser.js:162:20)
at Parser.parseTokens (/home/tbtonner/woodvilla/node_modules/postcss-values-parser/lib/parser.js:245:14)
at Parser.loop (/home/tbtonner/woodvilla/node_modules/postcss-values-parser/lib/parser.js:132:12)
at Parser.parse (/home/tbtonner/woodvilla/node_modules/postcss-values-parser/lib/parser.js:51:17)
at parse (/home/tbtonner/woodvilla/node_modules/postcss-custom-properties/index.cjs.js:47:30)
at /home/tbtonner/woodvilla/node_modules/postcss-custom-properties/index.cjs.js:333:24
at /home/tbtonner/woodvilla/node_modules/postcss/lib/container.js:194:18
at /home/tbtonner/woodvilla/node_modules/postcss/lib/container.js:139:18
at Rule.each (/home/tbtonner/woodvilla/node_modules/postcss/lib/container.js:105:16)
at Rule.walk (/home/tbtonner/woodvilla/node_modules/postcss/lib/container.js:135:17)
at /home/tbtonner/woodvilla/node_modules/postcss/lib/container.js:152:24
at Root.each (/home/tbtonner/woodvilla/node_modules/postcss/lib/container.js:105:16)
at Root.walk (/home/tbtonner/woodvilla/node_modules/postcss/lib/container.js:135:17)
at Root.walkDecls (/home/tbtonner/woodvilla/node_modules/postcss/lib/container.js:192:19)
at transformProperties (/home/tbtonner/woodvilla/node_modules/postcss-custom-properties/index.cjs.js:330:8)
at Object.syncTransform [as plugin] (/home/tbtonner/woodvilla/node_modules/postcss-custom-properties/index.cjs.js:522:5)
at /home/tbtonner/woodvilla/node_modules/postcss-preset-env/index.js:459:97
# ./app/frontend/packs/application.scss 2:26-228
# multi ./app/frontend/packs/application.js ./app/frontend/packs/application.scss
The line it's pointing to as a syntax error is #import 'bootstrap/dist/css/bootstrap'; in packs/application.scss.
Bootstrap is fully working with rails s and bin/webpack-dev-server running, so I'm unsure why it's throwing a syntax error here when precompiling the assets.
Upgrade bootstrap, better explanation here: https://github.com/rails/webpacker/issues/3188
There's a bug in Bootstrap 5.2.0 that is causing this. I had the exact same error, line 1 col 38.
See this issue and this one. My temporary solution was to downgrade Bootstrap to 5.1.3 while this is not fixed (the problem was patched in 5.1.2 (the first highlight) but is present in 5.2.0).
Edit: This PR fixes it. It should be released with 5.2.1.
Edit2: Bootstrap 5.2.1 is now released and should fix this.

build (mvn install) of new application takes forever

I was trying to use an existing application as starting point for a new one.
So, I copied over the src-folder, the pom and a couple of IDE-specific files config files.
I then refactored all giving it a new path and application name and then I wanted to do a first build and entered mvn install.
This process is now hanging since 1 1/2 hours in vaadin-maven-plugin:18.0.2:build-frontend (see full console output below).
Is this expected or why is this taking so long? Can I somehow figure out, why and where this is hanging?
What am I missing? Are there any files other then those mentioned that absolutely MUST exist before a new Vaadin application can (even be tried to) be built?
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< ch.zh.ksta.monitoring:my_app >---------------
[INFO] Building KStA-ZH-Monitoring 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # my_app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 7 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # my_app ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- vaadin-maven-plugin:18.0.2:prepare-frontend (default) # my_app ---
[INFO] writing file D:\Projects\my_app\target\flow-frontend\package.json.
[INFO] writing file D:\Projects\my_app\target\flow-frontend\form\package.json.
[INFO] writing file 'D:\Projects\my_app\target\index.html'
[INFO] writing file 'D:\Projects\my_app\target\index.ts'
[INFO] Copying frontend resources from jar files ...
[INFO] Visited 173 resources. Took 2229 ms.
[INFO]
[INFO] --- vaadin-maven-plugin:18.0.2:build-frontend (default) # my_app ---
[INFO] Scanning classes to find frontend configurations and dependencies...
[INFO] Visited 720 classes. Took 2553 ms.
[INFO] Visited 126 classes. Took 138 ms.
[INFO] writing file D:\Projects\my_app\target\flow-frontend\package.json.
[INFO] writing file D:\Projects\my_app\target\flow-frontend\form\package.json.
[INFO] writing file 'D:\Projects\my_app\target\index.html'
[INFO] writing file 'D:\Projects\my_app\target\index.ts'
[INFO] Parsing java files from [D:\Projects\my_app\src\main\java]
[INFO] There are no connect endpoints to generate.
[INFO] Running `pnpm install` to resolve and optionally download frontend dependencies. This may take a moment, please stand by...
[INFO] Generated pnpmfile hook file: 'D:\Projects\my_app\pnpmfile.js'
[INFO] installing pnpm version 4.4.0 locally
[INFO] using 'C:\Users\mmo\.vaadin\node\node.exe C:\Users\mmo\.vaadin\node_modules\pnpm\bin\pnpm.js' for frontend package installation
Later addition:
If I terminate this using ^C I get:
...
2021-05-31 18:24:40,199 ERROR [task-1] com.vaadin.flow.server.frontend.TaskRunNpmInstall: Command `C:\Program Files\nodejs\node.exe C:\Users\mmo\.vaadin\node_modules\pnpm\bin\pnpm.js --shamefully-hoist=true install` failed:
Using hooks from: D:\Projects\my_app\pnpmfile.jsreadPackage hook is declared. Manifests of dependencies might get overridden
2021-05-31 18:24:40,201 ERROR [task-1] com.vaadin.flow.server.frontend.TaskRunNpmInstall: >>> Dependency ERROR. Check that all required dependencies are deployed in pnpm repositories.
2021-05-31 18:24:40,205 DEBUG [task-1] com.vaadin.flow.server.startup.DevModeInitializer: Could not initialize dev mode handler. One of the node tasks failed
com.vaadin.flow.server.ExecutionFailedException: Pnpm install has exited with non zero status. Some dependencies are not installed. Check pnpm command output
at com.vaadin.flow.server.frontend.TaskRunNpmInstall.runNpmInstall(TaskRunNpmInstall.java:405)
at com.vaadin.flow.server.frontend.TaskRunNpmInstall.execute(TaskRunNpmInstall.java:120)
at com.vaadin.flow.server.frontend.NodeTasks.execute(NodeTasks.java:634)
at com.vaadin.flow.server.startup.DevModeInitializer.runNodeTasks(DevModeInitializer.java:471)
at com.vaadin.flow.server.startup.DevModeInitializer.lambda$initDevModeHandler$0(DevModeInitializer.java:381)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
If I restart the build again it will hang again.
Gee - is this brittle... :-(
Got this same error. I deleted from my home directory:
.vaadin
.pnpm-store
... and the generated stuff from my project:
webpack.config.js
tsconfig.json
types.d.ts
webpack.config.js
webpack.generated.js
pnpm-lock.yaml
pnpmfile.js
package.json
.npmrc
target
.pnpm-debug.log
... probably overkill, but then it worked again.

I get `this.getOptions is not a function` error when using coffee-loader on Rails 6.1

I created a brand new Rails app with Ruby 2.7.2 and Ruby on Rails 6.1.3:
rails new rails6
Then I installed the CoffeeScript compiler using the Rails command:
rails webpacker:install:coffee
But when i started the webpack-dev-server, he was unable to compile correctly:
Asset Size Chunks Chunk Names
js/application-30c16ea0138c526e20f5.js 515 KiB application [emitted] [immutable] application
js/application-30c16ea0138c526e20f5.js.map 579 KiB application [emitted] [dev] application
js/hello_coffee-5eba0c58c2666f949e88.js 395 KiB hello_coffee [emitted] [immutable] hello_coffee
js/hello_coffee-5eba0c58c2666f949e88.js.map 444 KiB hello_coffee [emitted] [dev] hello_coffee
manifest.json 710 bytes [emitted]
ERROR in ./app/javascript/packs/hello_coffee.coffee
Module build failed (from ./node_modules/coffee-loader/dist/cjs.js):
TypeError: this.getOptions is not a function
at Object.loader (/Users/iwan/dev/rails/rails6/node_modules/coffee-loader/dist/index.js:21:24)
ℹ 「wdm」: Failed to compile.
How to fix this issue?
I found that downgrading coffee-loader to the version 1.0.1 removed the error.
Edit package.json and change the version from
"coffee-loader": "^2.0.0",
to
"coffee-loader": "1.0.1",
Then run yarn install --check-files to apply the change.
Happy days!

Webpacker: The resolved_paths option has been deprecated. Use additional_paths instead

I bumped webpacker from 4.x to 5.2.1 and started getting this warning:
The resolved_paths option has been deprecated. Use additional_paths instead.
This seems straightforward enough, my config/webpacker.yml was almost unmodified:
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: [
'app/assets',
]
But doing a simple s/resolved_paths/additional_paths/ there doesn't work:
[Webpacker] Compiling...
[Webpacker] Compilation failed:
Hash: 7448f36a43523a84e146
Version: webpack 4.44.1
Time: 5803ms
Built at: 10/15/2020 11:57:06 AM
Asset Size Chunks Chunk Names
js/application-a019b363e4513fe092e6.js 3.02 MiB application [emitted] [immutable] application
js/application-a019b363e4513fe092e6.js.map 3.03 MiB application [emitted] [dev] application
js/hello_react-40e806bdb6de496532d8.js 1.05 MiB hello_react [emitted] [immutable] hello_react
js/hello_react-40e806bdb6de496532d8.js.map 1.21 MiB hello_react [emitted] [dev] hello_react
js/server_rendering-9cd9dcc6e1cebb2a8063.js 2.25 MiB server_rendering [emitted] [immutable] server_rendering
js/server_rendering-9cd9dcc6e1cebb2a8063.js.map 2.44 MiB server_rendering [emitted] [dev] server_rendering
manifest.json 1.05 KiB [emitted]
Entrypoint application = js/application-a019b363e4513fe092e6.js js/application-a019b363e4513fe092e6.js.map
Entrypoint hello_react = js/hello_react-40e806bdb6de496532d8.js js/hello_react-40e806bdb6de496532d8.js.map
Entrypoint server_rendering = js/server_rendering-9cd9dcc6e1cebb2a8063.js js/server_rendering-9cd9dcc6e1cebb2a8063.js.map
[./app/javascript/channels sync recursive _channel\.js$] ./app/javascript/channels sync _channel\.js$ 160 bytes {application} [built]
[./app/javascript/channels/index.js] 211 bytes {application} [built]
[./app/javascript/components sync recursive ^\.\/.*$] ./app/javascript/components sync ^\.\/.*$ 2.42 KiB {application} {server_rendering} [built]
[./app/javascript/packs/application.js] 10.3 KiB {application} [built]
[./app/javascript/packs/hello_react.jsx] 1.05 KiB {hello_react} [built]
[./app/javascript/packs/server_rendering.js] 301 bytes {server_rendering} [built]
[./node_modules/webpack/buildin/amd-options.js] (webpack)/buildin/amd-options.js 80 bytes {application} {server_rendering} [built]
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 905 bytes {application} {server_rendering} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 552 bytes {application} {server_rendering} [built]
+ 474 hidden modules
ERROR in ./app/javascript/components/menu/MenuComponent.jsx
Module not found: Error: Can't resolve 'images/ellipsis-v.svg' in '/home/me/app/javascript/components/menu'
So obviously additional_paths isn't just a drop-in replacement, even though the docs suggest it should be.
Before I jump into the source to try to understand what's happening here, anyone got a quick fix?
The error is logged in the web browser's console, and it comes from the npm package. You need to upgrade both: the webpacker gem and #rails/webpacker npm package.

Rails 5: Webpacker can't resolve 'vuelidate' and 'vuelidate/lib/validators' in prod

I am trying to use Vuelidate in production with Webpacker for my Rails app.
Usually I just need to run the following commands for my packages.json to get built and deployed into my app:
RAILS_ENV=production bundle exec rake assets:clobber
RAILS_ENV=production bundle exec rake assets:clean
RAILS_ENV=production bundle exec rake assets:precompile
but this isn't working in prod since I added Vuelidate (works fine in dev).
Using /home/my_user/my_app/config/webpacker.yml file for setting up webpack paths
Compiling…
Compilation failed:
Hash: a535894e7898c0a336a3
Version: webpack 3.5.6
Time: 13838ms
Asset Size Chunks Chunk Names
app-36e1d2de960efd5bf847.js.map 17.4 kB 2 [emitted] app
dashboard-9cadea07287686e15eed.js 99 kB 0 [emitted] dashboard
app-36e1d2de960efd5bf847.js 1.65 kB 2 [emitted] app
app-4758d50be4328c1ed27fc08a09d9dae2.css 119 bytes 2 [emitted] app
dashboard-9cadea07287686e15eed.js.map 808 kB 0 [emitted] dashboard
application-06c4c55e7d8c8e2ea0de.js.map 703 kB 1 [emitted] application
application-06c4c55e7d8c8e2ea0de.js 83.9 kB 1 [emitted] application
app-4758d50be4328c1ed27fc08a09d9dae2.css.map 117 bytes 2 [emitted] app
app-36e1d2de960efd5bf847.js.gz 843 bytes [emitted]
application-06c4c55e7d8c8e2ea0de.js.gz 30.5 kB [emitted]
dashboard-9cadea07287686e15eed.js.gz 35.4 kB [emitted]
manifest.json 518 bytes [emitted]
[1] (webpack)/buildin/global.js 509 bytes {0} {1} [built]
[2] ./app/javascript/packs/app.vue + 2 modules 1.65 kB {2} [built]
[3] ./node_modules/extract-text-webpack-plugin/dist/loader.js?{"omit":1,"remove":true}!./node_modules/vue-style-loader!./node_modules/css-loader?minimize!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-18f420a0","scoped":true,"hasInlineConfig":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./app/javascript/packs/app.vue 41 bytes {2} [built]
[5] ./app/javascript/packs/application.js 1.92 kB {1} [built]
[6] ./app/javascript/packs/dashboard.js + 1 modules 45.1 kB {0} [built]
[8] ./node_modules/css-loader?minimize!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-18f420a0","scoped":true,"hasInlineConfig":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./app/javascript/packs/app.vue 220 bytes [built]
+ 6 hidden modules
ERROR in ./app/javascript/packs/application.js
Module not found: Error: Can't resolve 'vuelidate' in '/home/my_user/my_app/app/javascript/packs'
# ./app/javascript/packs/application.js 13:0-34
ERROR in ./app/javascript/packs/dashboard.js
Module not found: Error: Can't resolve 'vuelidate' in '/home/my_user/my_app/app/javascript/packs'
# ./app/javascript/packs/dashboard.js 35:0-34
ERROR in ./app/javascript/packs/application.js
Module not found: Error: Can't resolve 'vuelidate/lib/validators' in '/home/my_user/my_app/app/javascript/packs'
# ./app/javascript/packs/application.js 14:0-59
ERROR in ./app/javascript/packs/dashboard.js
Module not found: Error: Can't resolve 'vuelidate/lib/validators' in '/home/my_user/my_app/app/javascript/packs'
# ./app/javascript/packs/dashboard.js 36:0-72
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js?minimize!node_modules/vue-loader/lib/style-compiler/index.js?{"vue":true,"id":"data-v-18f420a0","scoped":true,"hasInlineConfig":false}!node_modules/vue-loader/lib/selector.js?type=styles&index=0!app/javascript/packs/app.vue:
[0] ./node_modules/css-loader?minimize!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-18f420a0","scoped":true,"hasInlineConfig":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./app/javascript/packs/app.vue 220 bytes {0} [built]
+ 1 hidden module
here is my package.json file:
{
"license": "UNLICENSED",
"dependencies": {
"#rails/webpacker": "^3.0.1",
"vue": "^2.4.3",
"vue-loader": "^13.0.4",
"vue-resource": "^1.3.4",
"vue-template-compiler": "^2.4.3",
"vuelidate": "^0.5.0"
},
"devDependencies": {
"webpack-dev-server": "^2.8.1"
}
}
I'm guessing the pack isn't being properly installed to /home/my_user/my_app/app/javascript/packs. Any idea how I'd fix this?
Thanks in advance!

Resources