By hammid
I am using webpack to compile my node/expressjs application. When running the npm run build (which uses webpack), I keep getting the error ‘webpack not found’, even though I have all the webpack and webpack-cli dependency in my package.json
BUILD LOGS
backend | 18:59:31 > backend@1.0.0 build /workspace
backend | 18:59:31 > webpack
backend | 18:59:31
backend | 18:59:31 sh: 1: webpack: not found
backend | 18:59:31 npm ERR! code ELIFECYCLE
backend | 18:59:31 npm ERR! syscall spawn
backend | 18:59:31 npm ERR! file sh
backend | 18:59:31 npm ERR! errno ENOENT
backend | 18:59:31 npm ERR! backend@1.0.0 build: `webpack`
backend | 18:59:31 npm ERR! spawn ENOENT
backend | 18:59:31 npm ERR!
backend | 18:59:31 npm ERR! Failed at the backend@1.0.0 build script.
backend | 18:59:31 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
backend | 18:59:31
backend | 18:59:31 npm ERR! A complete log of this run can be found in:
backend | 18:59:31 npm ERR! /home/apps/.npm/_logs/2021-03-10T18_59_31_786Z-debug.log
backend | 18:59:31 building: exit status 1
backend | 18:59:31 ERROR: failed to build: exit status 1
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I used this command in the build script to ensure DO installs the devDependecy
npm install --only=dev && npm run build && npm prune --production
Further explanation can be found at this link
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.