ZoneMinder / zmNinja

High performance, cross platform ionic app for Home/Commerical Security Surveillance using ZoneMinder
http://zmninja.zoneminder.com
Other
1.01k stars 268 forks source link

Error: Cannot find module 'object-keys' #884

Closed mercurytoxic closed 4 years ago

mercurytoxic commented 4 years ago

Platform & OS Version

Linux red 5.4.8-arch1-1 #1 SMP PREEMPT Sat, 04 Jan 2020 23:46:18 +0000 x86_64 GNU/Linux

The version of zmNinja you are reporting:

Release 1.3.86

The version and OS of ZoneMinder you are using:

1.33.16, Linux zoneminder 5.4.8-arch1-1 #1 SMP PREEMPT Sat, 04 Jan 2020 23:46:18 +0000 x86_64 GNU/Linux

Device details:

Desktop

Details

When I try to run dist/zmninjapro-1.3.86-linux-x86_64.AppImage after a successful build with npm run dist-lin I get:

[vagrant@archlinux zmNinja]$ dist/zmninjapro-1.3.86-linux-x86_64.AppImage 
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'object-keys'
    at Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
    at Function.Module._resolveFilename (/tmp/.mount_zmninjzJr6pl/resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (internal/modules/cjs/loader.js:528:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/tmp/.mount_zmninjzJr6pl/resources/node_modules/deep-equal/index.js:1:173)
    at Object.<anonymous> (/tmp/.mount_zmninjzJr6pl/resources/node_modules/deep-equal/index.js:114:3)
    at Module._compile (internal/modules/cjs/loader.js:711:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)

Thanks!

mercurytoxic commented 4 years ago

For me the only way to be able to build it successfully was to do the following:

npm install

for some reason some modules seem to not correctly installed or the versions are wrong so I fixed it with:

npm install "object-keys@<1.1.1" "regexp.prototype.flags@<1.2.0" "function-bind@<1.1.1" "has@<1.0.3" "is-regex@<1.0.4" "object-is@<1.0.1" "is-arguments@<1.0.4" "define-properties@<1.1.3" "es-abstract@<1.17.0" "has-symbols@<1.0.1" "is-date-object@<1.0.1"

and then build and run:

npm run dist-lin
dist/zmninjapro-1.3.86-linux-x86_64.AppImage
neillbell commented 4 years ago

I no longer get the missing object-keys error. Now I get the following:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'is-arguments'
    at Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
    at Function.Module._resolveFilename (/tmp/.mount_zmninj8ESmci/resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (internal/modules/cjs/loader.js:528:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/tmp/.mount_zmninj8ESmci/resources/node_modules/deep-equal/index.js:2:19)
    at Object.<anonymous> (/tmp/.mount_zmninj8ESmci/resources/node_modules/deep-equal/index.js:114:3)
    at Module._compile (internal/modules/cjs/loader.js:711:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)

I tried adding is-arguments as you did object-keys, but I still get the same error. I must be missing something.

neillbell commented 4 years ago

I was able to get it to work with the following changes:

diff --git a/package.json b/package.json
index 511871a..3f0fc31 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "zmninjapro",
   "description": "Home security mobile app for ZoneMinder",
-  "version": "1.3.086",
+  "version":"1.3.086",
   "displayName": "zmNinja",
   "author": "Pliable Pixels",
   "license": "custom see LICENSE.md",
@@ -67,7 +67,17 @@
   "dependencies": {
     "app-builder-lib": "^22.1.0",
     "clivas": "^0.2.0",
+    "define-properties": "^1.1.3",
+    "es-abstract": "^1.17.0",
+    "function-bind": "^1.1.1",
+    "object-is": "^1.0.2",
     "object-keys": "^1.1.1",
+    "has": "^1.0.3",
+    "has-symbols": "^1.0.1",
+    "is-arguments": "^1.0.4",
+    "is-date-object": "^1.0.2",
+    "is-regex": "^1.0.5",
+    "regexp.prototype.flags": "^1.3.0",
     "cordova-android": "8.0.0",
     "cordova-custom-config": "^5.1.0",
     "cordova-ios": "^5.0.1",
@@ -158,8 +168,17 @@
       "node_modules/menu/**/*",
       "node_modules/clivas/**/*",
       "node_modules/keypress/**/*",
-      "node_modules/object-keys/**/*"
-
+      "node_modules/define-properties/**/*",
+      "node_modules/object-is/**/*",
+      "node_modules/object-keys/**/*",
+      "node_modules/es-abstract/**/*",
+      "node_modules/function-bind/**/*",
+      "node_modules/has/**/*",
+      "node_modules/has-symbols/**/*",
+      "node_modules/is-arguments/**/*",
+      "node_modules/is-date-object/**/*",
+      "node_modules/is-regex/**/*",
+      "node_modules/regexp.prototype.flags/**/*"
     ],
     "mac": {
       "category": "productivity",
@@ -195,4 +214,4 @@
       ]
     }
   }
-}
\ No newline at end of file
+}

This was kind of a pain in the ass. Is there a more elegant way to fix it?

pliablepixels commented 4 years ago

Are you trying to build via make-desktop or npm run? The latter is the right way.

neillbell commented 4 years ago

I'm using npm run.

pliablepixels commented 4 years ago

Ah yes, so object-keys likely has other dependencies which need to be manually copied over. I agree, it's dirty. I'll look at cleaning it up when I am back in town (end of month). More interestingly, I wonder why linux builds have this issue. I don't see it while building on my mac.

neillbell commented 4 years ago

That's odd. I built it on my Hackintosh and saw the same problem. When I use my new package.json it works correctly.

pliablepixels commented 4 years ago

I see - then maybe I need to try with a clean build.

mercurytoxic commented 4 years ago

Can verify that @neillbell patch works on my system.

pliablepixels commented 4 years ago

@neillbell can you do a PR please? I'll merge for now

neillbell commented 4 years ago

Sure thing.

mercurytoxic commented 4 years ago

885 Fixed this.