我目前正在使用 Laravel 8.48.2 和 Sail 包。我设置了 Sail,并通过 Docker Desktop 运行其映像,同时在 Windows 上将 WSL 2 与 Ubuntu 发行版结合使用。一切似乎都运转良好。
我运行后sail npm install,软件包已成功安装,但我收到以下消息:
npm notice New minor version of npm available! 7.18.1 -> 7.19.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.19.0
npm notice Run npm install -g npm@7.19.0 to update!
Run Code Online (Sandbox Code Playgroud)
因此,我尝试运行sail npm install -g npm@7.19.0,这给了我以下消息:
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/lib/node_modules/npm
npm ERR! dest /usr/lib/node_modules/.npm-qUIFSsiV
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm-qUIFSsiV'
npm ERR! [Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm-qUIFSsiV'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/lib/node_modules/npm',
npm ERR! dest: '/usr/lib/node_modules/.npm-qUIFSsiV'
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/sail/.npm/_logs/2021-06-26T15_27_02_291Z-debug.log
Run Code Online (Sandbox Code Playgroud)
如何更新 Sail 上的 NPM 版本?
先感谢您。
Son*_*nny 10
目前的工作方式:
sail root-shell
npm install -g npm@latest
Run Code Online (Sandbox Code Playgroud)
感谢@online Thomas(/sf/answers/4772176671/),为了解决我的问题,我按照以下步骤操作:
docker-compose exec laravel.test bash,它将您直接指向项目目录中的 docker 服务器(或类似的东西)。npm install -g npm@7.19.0它将 npm 更新到了新版本,没有任何问题。我按照@online Thomas的建议尝试了chown和命令,但没有成功。chmod我仍然无法sail npm install -g npm@7.19.0在 docker 服务器之外使用该命令。
| 归档时间: |
|
| 查看次数: |
5770 次 |
| 最近记录: |