Support
Quality
Security
License
Reuse
kandi has reviewed webpack-dashboard and discovered the below as its top functions. This is intended to give you an instant insight into webpack-dashboard implemented functionality, and help decide if they suit your requirements.
Get all kandi verified functions for this library.
Get all kandi verified functions for this library.
A CLI dashboard for webpack dev server
QUESTION
Node & Docker, can't run scripts after installing Node modules
Asked 2021-Jan-23 at 17:01Really struggling to identify the issue here. I'm attempting to containerize a WordPress site on my workstation for dev. purposes. (Disclaimer: somewhat new to Docker, currently using it on a few Laravel projects for the same purpose but have not yet integrated it in production).
Here is the related portion of my docker-compose.yml
version: "3"
services:
...
npm:
build:
context: .
dockerfile: ./docker/node/Dockerfile
container_name: npm
volumes:
- ./:/var/www/html
- /var/www/html/docker/
working_dir: /var/www/html/wp-content/themes/my-cust-theme
depends_on:
- wordpress
entrypoint: ["npm", "--no-bin-links"]
networks:
- wp-net
...
networks:
wp-net:
Here is the content of the related Dockerfile, (I had more in here, but in an effort to debug it's been reduced down to this):
FROM node:12.17.0-alpine3.9
RUN apk --update --no-cache --virtual build-dependencies add \
git \
libtool \
python2 \
nasm \
libpng-dev \
autoconf \
gcc \
g++ \
automake \
make
I know that a multi-stage build is preferable here, or the other methods mentioned here. Just trying to get the Node build scripts functioning before I optimize my containers.
After building containers with:
docker-compose up -d --build
I run:
docker-compose run --rm npm install
And the packages appear to install successfully. In fact, post-install running docker-compose run --rm npm list --depth 0
gives me the expected output. I can see all of the packages in my package.json
have been installed.
The scripts for my project are the following:
"scripts": {
"debug": " webpack-dev-server --config webpack.dev.js",
"dev": "webpack-dashboard -- webpack-dev-server --config webpack.dev.js",
"production": "NODE_ENV=production npx webpack --config webpack.prod.js --progress --hide-modules"
}
What I'm completely lost on at this point is: If I run
docker-compose run --rm npm run dev
The output looks something like:
Creating some-new-wp-site_npm_run ... done
> some-new-wp-site@1.0.0 dev /var/www/html/wp-content/themes/my-cust-theme
> webpack-dashboard -- webpack-dev-server --config webpack.dev.js
sh: webpack-dashboard: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! some-new-wp-site@1.0.0 dev: `webpack-dashboard -- webpack-dev-server --config webpack.dev.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the some-new-wp-site@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-01-23T15_51_28_095Z-debug
I've attempted running docker-compose down -v --rmi all
and repeating this process and it produced identical results.
ANSWER
Answered 2021-Jan-23 at 17:01without the npm err log
i can only guess where the problem is.
probably the npm-cli is not able find the webpack-dashboard
and webpack-dev-server
command because it is not installed globally.
try to add the webpack-dashboard
and webpack-dev-server
to your scripts inside the package.json.
"scripts": {
... your scripts,
"webpack-dashboard": "webpack-dashboard",
"webpack-dev-server": "webpack-dev-server"
}
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Save this library and start creating your kit
Open Weaver – Develop Applications Faster with Open Source