Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Running serve on latest MacOS version #1053

Closed
the-bay-kay opened this issue Feb 20, 2024 · 1 comment
Closed

Issue Running serve on latest MacOS version #1053

the-bay-kay opened this issue Feb 20, 2024 · 1 comment

Comments

@the-bay-kay
Copy link

Background

  • Working on a project for e-mission-phone
  • Updated work laptop (2021 M1 Macbook) to MacOs Sonoma 14.3.1

The Bug

  • When running the setup for UI Development (link), the npm run serve command fails with the following error:
 /Users/{user}/Documents/OpenPATH_Repos/e-mission-phone/node_modules/macos-release/index.js:28
 	const [name, version] = nameMap.get(release);
 	                        ^
 
 TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
     at macosRelease (/Users/{user}/Documents/OpenPATH_Repos/e-mission-phone/node_modules/macos-release/index.js:28:26)
     at osName (/Users/{user}/Documents/OpenPATH_Repos/e-mission-phone/node_modules/phonegap/node_modules/insight/node_modules/os-name/index.js:21:18)
     at new Insight (/Users/{user}/Documents/OpenPATH_Repos/e-mission-phone/node_modules/phonegap/node_modules/insight/lib/index.js:37:13)
     at Object.<anonymous> (/Users/{user}/Documents/OpenPATH_Repos/e-mission-phone/node_modules/phonegap/node_modules/cordova/src/telemetry.js:26:15)
     at Module._compile (node:internal/modules/cjs/loader:1246:14)
     at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
     at Module.load (node:internal/modules/cjs/loader:1103:32)
     at Module._load (node:internal/modules/cjs/loader:942:12)
     at Module.require (node:internal/modules/cjs/loader:1127:19)
     at require (node:internal/modules/helpers:112:18)
 
 Node.js v19.5.0
 phonegap --verbose serve exited with code 1
--> Sending SIGTERM to other processes..
 webpack --config webpack.dev.js --watch exited with code SIGTERM
  • As can be seen in this error message, the issue seems to be that macOs Sonoma is missing from node_modules/macos-release/index.js. The file contains the following versions, notably lacking Sonoma...
'use strict';
const os = require('os');

const nameMap = new Map([
	[22, ['Ventura', '13']],
	[21, ['Monterey', '12']],
	[20, ['Big Sur', '11']],
	// ...

Potential Solutions

Initially, I tried manually adding [23, ['Sonoma', '14']] to this file, with no success. This, of course, wouldn't't have been a long term solution (since this isn't tracked by our git). I believe there is different issue with our npm packages.
From what I've read in this stack overflow thread, the issue should be fixed then the corresponding node module is updated. Clicking through onto this thread, it seems that this module is dependant on cordova's version. When checking our package.serve.json, we have the following cordova-related dependancies...

    "cordova": "^11.1.0"
     "phonegap": "9.0.0+cordova.9.0.0",

Updating cordova to the latest version (12.0.0) does not fix the build error. This seems to suggest that the issue may be with ionic, or another related dependency. When running npm ls macos-release, we receive the following output:

├─┬ @ionic/cli@6.20.8
│ └─┬ os-name@4.0.1
│   └── macos-release@2.5.1
└─┬ phonegap@9.0.0
  ├─┬ insight@0.10.3
  │ └─┬ os-name@3.1.0
  │   └── macos-release@2.5.1 deduped
  └─┬ os-name@2.0.1
    └── macos-release@1.1.0

As can be seen here, this macos-release is a few versions behind the plugin's current 3.2.0 link.

My thought, then, is to begin updating these plugins, starting with the lowest version, until we find one that will (i) not break our codebase going too far forward, and (2) update the macos-release version to an acceptable value.

I'm currently being pulled in a few different directions, and won't be able to address this immediately -- the bluetooth integradtion (link) needs to be wrapped up first. My desktop PC is struggling, but I should be able to continue with Android Development while the macos serve is broken.

That being me to my final thoughts -- if anyone has experience with these version issues, please feel free to add your two cents! Any pointers or advice would be greatly appreciated.

@the-bay-kay
Copy link
Author

Finally found the solution! As Jack and Shankari suggested, the issue was with node_modules/macos-release/index.js and setup/autoreload/macos-index.js. The solution was to:

  • Edit setup/autoreload/macos-index.js, adding my current MacOS version as follows:
    'use strict';
    const os = require('os');
    
    const nameMap = new Map([
        [23, ['Sonoma', '14.3.1']], // <- Version added
        [22, ['Ventura', '13']],
        [21, ['Monterey', '12']],
        // More versions below
    ]); // more code below
  • After adding this line, run bash setup/setup_serve.sh, and source setup/activate_serve.sh.
  • Go into node_modules/macos-release/index.js, and add the missing MacOS version, as above.
  • With this, you should be able to either run npm start serve, or continue to building to hardware!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant