没有不值得去解决的问题,也没有不值得去学习的技术!

Update Shopify CLI to the Latest Version in Ubuntu-20.04 on WSL2

Run shopify upgrade to update Shopify CLI to the latest version. An error occurs: Error: EACCES: permission denied, rename '/usr/lib/node_modules/@shopify/cli' -> '/usr/lib/node_modules/@shopify/.cli-9RdBklQd'

1. Run shopify version to check the current version of Shopify CLI.

Plaintext
wangqiang@DESKTOP-QLPK8QM:~$ shopify version
Current Shopify CLI version: 3.49.7
💡 Version 3.52.0 available!

2. Run shopify upgrade to update Shopify CLI to the latest version. An error occurs: Error: EACCES: permission denied, rename ‘/usr/lib/node_modules/@shopify/cli’ -> ‘/usr/lib/node_modules/@shopify/.cli-9RdBklQd’ . See Figure 1.

Run shopify upgrade to update Shopify CLI to the latest version. An error occurs: Error: EACCES: permission denied, rename '/usr/lib/node_modules/@shopify/cli' -> '/usr/lib/node_modules/@shopify/.cli-9RdBklQd'
Figure 1
Plaintext

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 ERR! 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 likely 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 elevate privileges, and the error no longer occurs.

Plaintext

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. However, checking the version number shows no change. Reference: https://www.shuijingwanwq.com/2023/11/29/8249/ When running: shopify version, it prompts: Version 3.49.7 available!, but after successfully running: shopify upgrade, it still prompts: Version 3.49.7 available!. I decide to hold off on dealing with this for now.

Plaintext

wangqiang@DESKTOP-QLPK8QM:~$ shopify version
Current Shopify CLI version: 3.49.7
💡 Version 3.52.0 available!

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系