I wanna make my own image so i use centos image to build an image of nodejs 7.10 environment.
After I add my nodejs project to the docker and then run npm install and npm run build it failed in the npm run build step .
The details are the below:
intbee-square@0.0.0 build /data/server/intbee_square/client
webpack -p
module.js:472
throw err;
^
Error: Cannot find module ‘extract-text-webpack-plugin’
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/data/server/intbee_square/client/webpack.config.js:3:27)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “build”
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! intbee-square@0.0.0 build: webpack -p
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the intbee-square@0.0.0 build script ‘webpack -p’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the intbee-square package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack -p
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs intbee-square
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls intbee-square
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/.npm/_logs/2017-06-09T08_22_51_971Z-debug.log
My Dockerfile are the below:
FROM node7:10
ENV NODE_ENV=production
MAINTAINER Ray
RUN mkdir -p /data/server
ADD . /data/server
RUN cd /data/server/intbee_square/client &&
npm install -g &&
npm run build
If i just build an image after npm install and then start up a container and run npm run build in container it is successfully.
I cannot figure it out why “npm run build” cannot run in dockerfile?