Cannot implement node modules
DougDevCP opened this issue · 2 comments
I am trying to implement the example from this website without success.
I have installed react-native and react-native-sqlite-storage modules, but getting the following message after executing npm run build:
Hash: 67262a2c754e5f60a5f7
Version: webpack 4.44.2
Time: 837ms
Built at: 03/31/2021 12:09:42 AM
1 asset
Entrypoint main = index.js
[3] multi ./src/index.tsx 28 bytes {0} [built]
[4] ./src/index.tsx 1.76 KiB {0} [built]
+ 6 hidden modules
ERROR in ./node_modules/react-native/index.js 14:7
Module parse failed: Unexpected token (14:7)
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
|
| // Components
import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo';
| import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator';
| import typeof Button from './Libraries/Components/Button';
@ ./src/index.tsx 2:0-93 19:4-9 22:42-54 26:38-42 28:38-54 31:38-42 36:15-25
@ multi ./src/index.tsx
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! react-nodegui-starter@1.0.0 build:webpack -p
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the react-nodegui-starter@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2021-03-30T21_09_42_797Z-debug.log
The error log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm@6.14.11
3 info using node@v14.16.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle react-nodegui-starter@1.0.0prebuild: react-nodegui-starter@1.0.0build: react-nodegui-starter@1.0.0
6 info lifecycle react-nodegui-starter@1.0.0
7 verbose lifecycle react-nodegui-starter@1.0.0build: unsafe-perm in lifecycle truebuild: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Administrator\AppData\Roaming\npm\react-nodegui-starter\node_modules.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\Csound6_x64\bin;C:\Program Files\Cabbage;C:\Program Files\CMake\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Users\Administrator.windows-build-tools\python27;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;;C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Roaming\npm
8 verbose lifecycle react-nodegui-starter@1.0.0
9 verbose lifecycle react-nodegui-starter@1.0.0build: CWD: C:\Users\Administrator\AppData\Roaming\npm\react-nodegui-starterbuild: Args: [ '/d /s /c', 'webpack -p' ]
10 silly lifecycle react-nodegui-starter@1.0.0
11 silly lifecycle react-nodegui-starter@1.0.0build: Returned: code: 2 signal: nullbuild: Failed to exec build script
12 info lifecycle react-nodegui-starter@1.0.0
13 verbose stack Error: react-nodegui-starter@1.0.0 build: webpack -p
13 verbose stack Exit status 2
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid react-nodegui-starter@1.0.0
15 verbose cwd C:\Users\Administrator\AppData\Roaming\npm\react-nodegui-starter
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build"
18 verbose node v14.16.0
19 verbose npm v6.14.11
20 error code ELIFECYCLE
21 error errno 2
22 error react-nodegui-starter@1.0.0 build: webpack -p
22 error Exit status 2
23 error Failed at the react-nodegui-starter@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
What is the problem here, i.e. how to implement node modules here?
Also, is it possible to build a Double-entry bookkeeping desktop app with NodeGui with sqlite3 and do a CRUD operations in a table that fetches data from the database with simply installing and using node modules?
You're trying to implement/create a local sqlite db, right? But react-native & react-native-sqlite-storage only works with IOS/Android devices. react-native-sqlite-storage package binds android/ios's sqlite db for react-native. But this modules doesn't work in desktop environments. You can use sqlite & sqlite3 packages which typically works same as react-native-sqlite-storage but in desktop os
Also i18n & node-localstorage are also a good alternative
Remember, you can use any node_modules that run perfectly in nodejs which is the biggest plus point of this react-nodegui
React Native is different from what react-nodegui is.
Instead of using react-native's sqlite, you could try a node module that works with nodejs instead.