我正在尝试Dockerize MEAN应用程序并遇到有关Angular容器的问题。
ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss"}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/custom_theme.scss
angular_1 | Module build failed: Error: Missing binding /usr/src/app/node_modules/node-sass/vendor/linux-x64-57/binding.node
angular_1 | Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 8.x
angular_1 |
angular_1 | Found bindings for the following environments:
angular_1 | - Windows 64-bit with Node.js 8.x
angular_1 |
angular_1 | This usually happens because your environment has changed since running `npm install`.
angular_1 | Run `npm rebuild node-sass --force` to build the binding for your current environment.
angular_1 | at module.exports (/usr/src/app/node_modules/node-sass/lib/binding.js:15:13)
angular_1 | at Object.<anonymous> (/usr/src/app/node_modules/node-sass/lib/index.js:14:35)
angular_1 | at Module._compile (module.js:635:30)
angular_1 | at Object.Module._extensions..js (module.js:646:10)
angular_1 | at Module.load (module.js:554:32)
angular_1 | at tryModuleLoad (module.js:497:12)
angular_1 | at Function.Module._load (module.js:489:3)
angular_1 | at Module.require (module.js:579:17)
angular_1 | at require (internal/module.js:11:18)
angular_1 | at Object.<anonymous> (/usr/src/app/node_modules/sass-loader/lib/loader.js:3:14)
angular_1 | at Module._compile (module.js:635:30)
angular_1 | at Object.Module._extensions..js (module.js:646:10)
angular_1 | at Module.load (module.js:554:32)
angular_1 | at tryModuleLoad (module.js:497:12)
angular_1 | at Function.Module._load (module.js:489:3)
angular_1 | at Module.require (module.js:579:17)
angular_1 | @ ./src/custom_theme.scss 4:14-197
angular_1 | @ multi ./src/styles.css ./src/custom_theme.scss
我尝试将npm rebuild node-sass --force
添加到我的dockerfile但没有成功。这是:
FROM node:8
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm cache clean --force
RUN npm install
COPY . /usr/src/app
RUN npm rebuild node-sass --force
EXPOSE 4200
CMD ["npm","start"]