docker - EPERM : operation not permitted, 在 Windows 中打开 '/app/yarn-error.log'

标签 docker node-modules yarnpkg

所以我正在阅读 docker 教程,并在我的 power shell 中执行了这个:

docker run -dp 3000:3000 `
-w /app -v "$(pwd):/app" `
node:12-alpine `
sh -c "yarn install && yarn run dev"
但是我的容器在运行后立即退出。
所以在观察日志后,这似乎是问题所在:
yarn install v1.22.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error Could not write file "/app/yarn-error.log": "EPERM: operation not permitted, open 
'/app/yarn-error.log'"
error An unexpected error occurred: "EPERM: operation not permitted, mkdir '/app/node_modules'".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
我在管理员模式下运行 PowerShell,没有项目文件是只读的,并且在文件夹属性中,用户和管理员拥有完全控制权。那么为什么会出现这个问题呢?

最佳答案

我通过更改文件夹权限访问/app/来修复它。
它只允许我进行更改,所以我将其更改为允许访问写入执行和读取到所有人并且它工作正常。
因此,更改文件夹的正确访问权限应该可以解决您的问题。

关于docker - EPERM : operation not permitted, 在 Windows 中打开 '/app/yarn-error.log',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65058108/

相关文章:

node.js - 如何在 node.js 中的模块之间共享连接池?

javascript - Node JS 服务器端应用程序部署注意事项

docker - 在 docker 上本地运行 HAProxy 的问题

django - linux “date”是正确的,但是python tzlocal报告docker容器中的utc

docker - 获取在 Docker 容器中运行的 Logstash 中的主机名

npm - yarn run 和 npm start 有什么区别?

全局安装包的 Ubuntu 18.04 Yarn 二进制文件

Docker 标签在 Bitbucket 管道中的步骤之间丢失

ruby-on-rails - 如何修复默认 "rails new app"和 "npx create-react-app"的这些依赖性问题?

node.js - 如何从node.js以编程方式运行 `yarn tag`?