【发布时间】:2018-08-14 18:55:56
【问题描述】:
我正在努力在基于 node:latest 的 docker 容器中设置 webpack 开发服务器
尽管尝试了Node Sass could not find a binding for your current environment 中的所有各种咒语,我仍然收到相同的错误:
web_1 | ERROR in ./~/css-loader!./~/sass-loader/lib/loader.js!./src/sass/style.sass
web_1 | Module build failed: Error: Missing binding /prject/node_modules/node-sass/vendor/linux-x64-59/binding.node
web_1 | Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 9.x
web
这是当前的
# Dockerfile
RUN yarn cache clean && yarn install --non-interactive --force
RUN rm -rf node_modules/node_sass
RUN npm rebuild node-sass
重建步骤表明二进制文件已安装并检出:
Binary found at /advocate/node_modules/node-sass/vendor/linux-x64-59/binding.node
Testing binary
Binary is fine
让我感到困惑的是我确实得到了这个
web_1 | Found bindings for the following environments:
web_1 | - OS X 64-bit with Node.js 7.x
这让我觉得它以某种我不太理解的能力使用主机平台。
【问题讨论】:
-
尝试将
node_modules添加到您的.dockerignore文件中。安装将需要更长的时间,但您不应在开发环境和容器之间进行任何交叉。 -
我这样做了,它工作了大约 12 个小时,但现在又出现了同样的错误(无疑是由于我在此期间做了某事).. . 是否有可能
docker-compose卷条目是罪魁祸首?- ../code-frontend/:/code/... 初始测试(注释掉所述行并重建)建议如此
标签: node.js docker webpack-dev-server node-sass webpack-style-loader