[NPMCLI-168] Cannot -g install 2.2.0 over 3.0.0-snapshot (2.1.0 over 2.2.0 works) Created: 22/Feb/18  Updated: 22/Feb/18  Resolved: 22/Feb/18

Status: Closed
Project: Magnolia CLI
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Martin DrĂ¡pela Assignee: Unassigned
Resolution: Not an issue Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

Global installation of 2.1.0 over 2.2.0 works (see A below) but global installation of 2.2.0 over 3.0.0-snapshot does not (B below) and one has to uninstall the 3.0.0-snapshot first and only then install 2.2.0.


# A1) install latest mgnl CLI globally

m@ubuntuMini:~$ sudo npm install @magnolia/cli -g
/usr/bin/mgnl -> /usr/lib/node_modules/@magnolia/cli/bin/mgnl.js

> spawn-sync@1.0.15 postinstall /usr/lib/node_modules/@magnolia/cli/node_modules/spawn-sync
> node postinstall

+ @magnolia/cli@2.2.0
added 209 packages in 8.658s

# A2) show mgnl CLI version (expecting "2.2.0")

m@ubuntuMini:~$ mgnl -V
2.2.0

# A3) install 2.1.0 over 2.2.0 globally

m@ubuntuMini:~$ sudo npm install @magnolia/cli@2.1.0 -g
/usr/bin/mgnl -> /usr/lib/node_modules/@magnolia/cli/bin/mgnl.js
+ @magnolia/cli@2.1.0
updated 1 package in 11.658s

# A4) show mgnl CLI version (expecting "2.1.0")

m@ubuntuMini:~$ mgnl -V
2.1.0


# B1) install 3.0.0-snapshot globally

m@ubuntuMini:~$ cd npm-cli/
m@ubuntuMini:~/npm-cli$ sudo npm install . -g
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/bin/mgnl -> /usr/lib/node_modules/@magnolia/cli/bin/mgnl.js
+ @magnolia/cli@3.0.0-snapshot
added 374 packages in 13.168s

# B2) show mgnl version (expecting "3.0.0-snapshot (node.js: v8.9.4)")

m@ubuntuMini:~/npm-cli$ mgnl -v
Magnolia CLI: 3.0.0-snapshot (node.js: v8.9.4)

# B3) install latest CLI over 3.0.0-snapshot globally

m@ubuntuMini:~/npm-cli$ sudo npm install @magnolia/cli -g
/usr/bin/mgnl -> /usr/lib/node_modules/@magnolia/cli/bin/mgnl.js

> spawn-sync@1.0.15 postinstall /usr/lib/node_modules/@magnolia/cli/node_modules/spawn-sync
> node postinstall

+ @magnolia/cli@2.2.0
added 26 packages and updated 55 packages in 7.949s

# B4) show mgnl version (expecting "2.2.0")

m@ubuntuMini:~/npm-cli$ mgnl -V
module.js:540
    throw err;
    ^

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/lib/node_modules/@magnolia/cli/bin/mgnl.js:6:16)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3


 Comments   
Comment by Martin DrĂ¡pela [ 22/Feb/18 ]

Will work but npm pack must be executed in an extra step and the snapshot installed from the pack created:

# B1) install 3.0.0-snapshot globally

m@ubuntuMini:~$ cd npm-cli/
m@ubuntuMini:~/npm-cli$ npm pack
m@ubuntuMini:~/npm-cli$ sudo npm install magnolia-cli-3.0.0-snapshot.tgz -g

(Closing the ticket.)

Generated at Mon Feb 12 04:47:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.