Ubuntu-20.04 in WSL2, update Shopify CLI to the latest version
1. Execute Shopify Version to see the current version of Shopify CLI
wangqiang@desktop-qlpk8qm:~$ Shopify version Current Shopify CLI Version: 3.49.7 💡 Version 3.52.0 Available!
2. Execute Shopify Upgrade to update the Shopify CLI to the latest version, and an error: Error: Eacces: Permission denied, Rename/usr/lib/node_modules/@shopify/cli->/usr/lib/node_modules/@shopify/.cli-9rdbklqd. as shown in Figure 1
wangqiang@desktop-qlpk8qm:~$ Shopify Upgrade
Upgrading CLI from 3.49.7 to 3.52.0...
Attempting to upgrade via npm install -g @shopify/cli@latest @shopify/theme@latest...
npm err! code eacces
npm err! syscall rename
npm err! path /usr/lib/node_modules/@shopify/cli
npm err! dest /usr/lib/node_modules/@shopify/.cli-9rdbklqd
npm err! errno -13
NPM ERROR: Eacces: Permission Denied, Rename/usr/lib/node_modules/@shopify/cli->/usr/lib/node_modules/@shopify/.cli-9rdbklqd
npm err![Error: EACCES: permission denied, rename '/usr/lib/node_modules/@shopify/cli' -> '/usr/lib/node_modules/@shopify/.cli-9RdBklQd']{
npm err! errno: -13,
npm err! code:Eacces,
npm err! syscall:rename,
npm err! path:/usr/lib/node_modules/@shopify/cli,
npm err! dest:/usr/lib/node_modules/@shopify/.cli-9rdbklqd
npm err! }
npm err!
npm err! the operation was rejected by your operating system.
npm err! It is like you do not have the permissions to access this file as the current user
npm err!
npm err! If you believe this might be a permissions issue, please double-check the
NPM ERR! Permissions of the file and its containing directories, or try running
NPM err! The command again as root/administrator.
npm err! a complete log of this run can be found in:
npm err! /home/wangqiang/.npm/_logs/2023-12-07t03_09_49_269z-debug-0.log
upgrade failed!
─ ─ external error - -
error coming from `npm install -g @shopify/cli@latest @shopify/theme@latest`
command failed with exit code 243: npm install -g @shopify/cli@latest @shopify/theme@latest
────────────────────────────────────── ──────────────────────────────────────
3. Add sudo before the command npm install -g @shopify/cli@latest @shopify/theme@latest to increase the permissions, no more errors are reported
wangqiang@desktop-qlpk8qm:~$ sudo npm install -g @shopify/cli@latest @shopify/theme@latest Changed 1013 packages in 1M 121 Packages are looking for funding run `npm fund` for details
4, but check the version number, still no change. Reference:https://www.shuijingwanwq.com/2023/11/29/8249/When executing: Shopify version, prompt: Version 3.49.7 Available!, but after execution: After the Shopify Upgrade is successful, it still prompts: Version 3.49.7 available!. Decided to suspend processing.
wangqiang@desktop-qlpk8qm:~$ Shopify version Current Shopify CLI Version: 3.49.7 💡 Version 3.52.0 Available!
