Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

george1's avatar

Errors when running npm run production

Hi

I am completely new to npm and I am already getting a BUNCH of errors when I run npm production. I don't use npm but I suddenly need it in order to use mix to minify my JS, CSS and HTML. Does anyone knows how to fix npm?

Below is the output.

me@mine-MacBook-Pro me % npm run production                                         

> @ production /Users/me/sites/me
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js



 ERROR  Failed to compile with 24 errors                                                                                                                                                                                         10:32:49

These dependencies were not found:

* child_process in ./node_modules/gulp-notify/node_modules/node-notifier/lib/utils.js
* fs in ./node_modules/clean-css/lib/clean.js, ./node_modules/clean-css/lib/imports/inliner.js and 21 others

To install them, you can run: npm install --save child_process fs
 2 assets

WARNING in ./node_modules/clean-css/node_modules/source-map/lib/source-map/source-map-generator.js 8:45-52
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/clean-css/node_modules/source-map/lib/source-map.js
 @ ./node_modules/clean-css/lib/utils/input-source-map-tracker.js
 @ ./node_modules/clean-css/lib/clean.js
 @ ./node_modules/clean-css/index.js
 @ ./node_modules/html-minifier/src/htmlminifier.js
 @ ./node_modules/gulp-htmlmin/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/clean-css/node_modules/source-map/lib/source-map/source-map-consumer.js 8:45-52
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/clean-css/node_modules/source-map/lib/source-map.js
 @ ./node_modules/clean-css/lib/utils/input-source-map-tracker.js
 @ ./node_modules/clean-css/lib/clean.js
 @ ./node_modules/clean-css/index.js
 @ ./node_modules/html-minifier/src/htmlminifier.js
 @ ./node_modules/gulp-htmlmin/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/clean-css/node_modules/source-map/lib/source-map/source-node.js 8:45-52
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/clean-css/node_modules/source-map/lib/source-map.js
 @ ./node_modules/clean-css/lib/utils/input-source-map-tracker.js
 @ ./node_modules/clean-css/lib/clean.js
 @ ./node_modules/clean-css/index.js
 @ ./node_modules/html-minifier/src/htmlminifier.js
 @ ./node_modules/gulp-htmlmin/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/laravel-elixir/dist/index.js 34:11-32
Critical dependency: the request of a dependency is an expression
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/laravel-elixir/dist/bootstrap/LoadExtensions.js 26:8-21
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/require-dir/index.js 118:32-45
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/laravel-elixir/dist/bootstrap/LoadExtensions.js
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/require-dir/index.js 123:32-45
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/laravel-elixir/dist/bootstrap/LoadExtensions.js
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/natives/index.js 50:17-28
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/graceful-fs/fs.js
 @ ./node_modules/graceful-fs/graceful-fs.js
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/lazy-debug-legacy/src/functions.js 62:15-40
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/lazy-debug-legacy/src/index.js
 @ ./node_modules/debug-fabulous/src/lazy-debug.js
 @ ./node_modules/debug-fabulous/index.js
 @ ./node_modules/gulp-sourcemaps/src/init/index.js
 @ ./node_modules/gulp-sourcemaps/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/index.js
 @ ./node_modules/module/dist/index.js
 @ ./node_modules/natives/index.js
 @ ./node_modules/graceful-fs/fs.js
 @ ./node_modules/graceful-fs/graceful-fs.js
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/lazy-debug-legacy/src/functions.js 87:8-28
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/lazy-debug-legacy/src/index.js
 @ ./node_modules/debug-fabulous/src/lazy-debug.js
 @ ./node_modules/debug-fabulous/index.js
 @ ./node_modules/gulp-sourcemaps/src/init/index.js
 @ ./node_modules/gulp-sourcemaps/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/index.js
 @ ./node_modules/module/dist/index.js
 @ ./node_modules/natives/index.js
 @ ./node_modules/graceful-fs/fs.js
 @ ./node_modules/graceful-fs/graceful-fs.js
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/require-dir/index.js 95:20-38
require.extensions is not supported by webpack. Use a loader instead.
 @ ./node_modules/laravel-elixir/dist/bootstrap/LoadExtensions.js 15:4-26
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

WARNING in ./node_modules/require-dir/index.js 98:54-72
require.extensions is not supported by webpack. Use a loader instead.
 @ ./node_modules/laravel-elixir/dist/bootstrap/LoadExtensions.js 15:4-26
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/gulp-notify/node_modules/node-notifier/lib/utils.js
Module not found: Error: Can't resolve 'child_process' in '/Users/me/sites/me/node_modules/gulp-notify/node_modules/node-notifier/lib'
 @ ./node_modules/gulp-notify/node_modules/node-notifier/lib/utils.js 1:9-33
 @ ./node_modules/gulp-notify/node_modules/node-notifier/index.js
 @ ./node_modules/gulp-notify/lib/extra_api.js
 @ ./node_modules/gulp-notify/index.js
 @ ./node_modules/laravel-elixir/dist/Notification.js
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/clean-css/lib/clean.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/clean-css/lib'
 @ ./node_modules/clean-css/lib/clean.js 29:9-22
 @ ./node_modules/clean-css/index.js
 @ ./node_modules/html-minifier/src/htmlminifier.js
 @ ./node_modules/gulp-htmlmin/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/clean-css/lib/imports/inliner.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/clean-css/lib/imports'
 @ ./node_modules/clean-css/lib/imports/inliner.js 1:9-22
 @ ./node_modules/clean-css/lib/clean.js
 @ ./node_modules/clean-css/index.js
 @ ./node_modules/html-minifier/src/htmlminifier.js
 @ ./node_modules/gulp-htmlmin/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/clean-css/lib/utils/input-source-map-tracker.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/clean-css/lib/utils'
 @ ./node_modules/clean-css/lib/utils/input-source-map-tracker.js 3:9-22
 @ ./node_modules/clean-css/lib/clean.js
 @ ./node_modules/clean-css/index.js
 @ ./node_modules/html-minifier/src/htmlminifier.js
 @ ./node_modules/gulp-htmlmin/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/clone-stats/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/clone-stats'
 @ ./node_modules/clone-stats/index.js 1:11-24
 @ ./node_modules/vinyl/index.js
 @ ./node_modules/gulp-util/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/css/lib/stringify/source-map-support.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/css/lib/stringify'
 @ ./node_modules/css/lib/stringify/source-map-support.js 10:9-22
 @ ./node_modules/css/lib/stringify/index.js
 @ ./node_modules/css/index.js
 @ ./node_modules/gulp-sourcemaps/src/init/index.js
 @ ./node_modules/gulp-sourcemaps/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/index.js
 @ ./node_modules/module/dist/index.js
 @ ./node_modules/natives/index.js
 @ ./node_modules/graceful-fs/fs.js
 @ ./node_modules/graceful-fs/graceful-fs.js
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/gaze/lib/gaze.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/gaze/lib'
 @ ./node_modules/gaze/lib/gaze.js 14:9-22
 @ ./node_modules/glob-watcher/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/glob/glob.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/glob'
 @ ./node_modules/glob/glob.js 43:9-22
 @ ./node_modules/glob-stream/index.js
 @ ./node_modules/vinyl-fs/lib/src/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/glob/sync.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/glob'
 @ ./node_modules/glob/sync.js 4:9-22
 @ ./node_modules/glob/glob.js
 @ ./node_modules/glob-stream/index.js
 @ ./node_modules/vinyl-fs/lib/src/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/globule/lib/globule.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/globule/lib'
 @ ./node_modules/globule/lib/globule.js 11:9-22
 @ ./node_modules/gaze/lib/gaze.js
 @ ./node_modules/glob-watcher/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/globule/node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/globule/node_modules/graceful-fs'
 @ ./node_modules/globule/node_modules/graceful-fs/graceful-fs.js 5:17-30
 @ ./node_modules/globule/node_modules/glob/glob.js
 @ ./node_modules/globule/lib/globule.js
 @ ./node_modules/gaze/lib/gaze.js
 @ ./node_modules/glob-watcher/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/growly/lib/gntp.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/growly/lib'
 @ ./node_modules/growly/lib/gntp.js 4:9-22
 @ ./node_modules/growly/lib/growly.js
 @ ./node_modules/gulp-notify/node_modules/node-notifier/notifiers/growl.js
 @ ./node_modules/gulp-notify/node_modules/node-notifier/index.js
 @ ./node_modules/gulp-notify/lib/extra_api.js
 @ ./node_modules/gulp-notify/index.js
 @ ./node_modules/laravel-elixir/dist/Notification.js
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/gulp-notify/node_modules/node-notifier/lib/utils.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/gulp-notify/node_modules/node-notifier/lib'
 @ ./node_modules/gulp-notify/node_modules/node-notifier/lib/utils.js 3:9-22
 @ ./node_modules/gulp-notify/node_modules/node-notifier/index.js
 @ ./node_modules/gulp-notify/lib/extra_api.js
 @ ./node_modules/gulp-notify/index.js
 @ ./node_modules/laravel-elixir/dist/Notification.js
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/gulp-sourcemaps/node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/gulp-sourcemaps/node_modules/graceful-fs'
 @ ./node_modules/gulp-sourcemaps/node_modules/graceful-fs/graceful-fs.js 1:9-22
 @ ./node_modules/gulp-sourcemaps/src/init/index.internals.js
 @ ./node_modules/gulp-sourcemaps/src/init/index.js
 @ ./node_modules/gulp-sourcemaps/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/index.js
 @ ./node_modules/module/dist/index.js
 @ ./node_modules/natives/index.js
 @ ./node_modules/graceful-fs/fs.js
 @ ./node_modules/graceful-fs/graceful-fs.js
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/isexe/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/isexe'
 @ ./node_modules/isexe/index.js 1:9-22
 @ ./node_modules/which/which.js
 @ ./node_modules/gulp-notify/node_modules/node-notifier/notifiers/notifysend.js
 @ ./node_modules/gulp-notify/node_modules/node-notifier/index.js
 @ ./node_modules/gulp-notify/lib/extra_api.js
 @ ./node_modules/gulp-notify/index.js
 @ ./node_modules/laravel-elixir/dist/Notification.js
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/isexe/mode.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/isexe'
 @ ./node_modules/isexe/mode.js 4:9-22
 @ ./node_modules/isexe/index.js
 @ ./node_modules/which/which.js
 @ ./node_modules/gulp-notify/node_modules/node-notifier/notifiers/notifysend.js
 @ ./node_modules/gulp-notify/node_modules/node-notifier/index.js
 @ ./node_modules/gulp-notify/lib/extra_api.js
 @ ./node_modules/gulp-notify/index.js
 @ ./node_modules/laravel-elixir/dist/Notification.js
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/isexe/windows.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/isexe'
 @ ./node_modules/isexe/windows.js 4:9-22
 @ ./node_modules/isexe/index.js
 @ ./node_modules/which/which.js
 @ ./node_modules/gulp-notify/node_modules/node-notifier/notifiers/notifysend.js
 @ ./node_modules/gulp-notify/node_modules/node-notifier/index.js
 @ ./node_modules/gulp-notify/lib/extra_api.js
 @ ./node_modules/gulp-notify/index.js
 @ ./node_modules/laravel-elixir/dist/Notification.js
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/mkdirp/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/mkdirp'
 @ ./node_modules/mkdirp/index.js 2:9-22
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/module/node_modules/glob/glob.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/module/node_modules/glob'
 @ ./node_modules/module/node_modules/glob/glob.js 43:9-22
 @ ./node_modules/module/node_modules/glob-stream/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/lib/src/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/index.js
 @ ./node_modules/module/dist/index.js
 @ ./node_modules/natives/index.js
 @ ./node_modules/graceful-fs/fs.js
 @ ./node_modules/graceful-fs/graceful-fs.js
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/module/node_modules/glob/sync.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/module/node_modules/glob'
 @ ./node_modules/module/node_modules/glob/sync.js 4:9-22
 @ ./node_modules/module/node_modules/glob/glob.js
 @ ./node_modules/module/node_modules/glob-stream/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/lib/src/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/index.js
 @ ./node_modules/module/dist/index.js
 @ ./node_modules/natives/index.js
 @ ./node_modules/graceful-fs/fs.js
 @ ./node_modules/graceful-fs/graceful-fs.js
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/module/node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/module/node_modules/graceful-fs'
 @ ./node_modules/module/node_modules/graceful-fs/graceful-fs.js 1:9-22
 @ ./node_modules/module/node_modules/vinyl-fs/lib/symlink/index.js
 @ ./node_modules/module/node_modules/vinyl-fs/index.js
 @ ./node_modules/module/dist/index.js
 @ ./node_modules/natives/index.js
 @ ./node_modules/graceful-fs/fs.js
 @ ./node_modules/graceful-fs/graceful-fs.js
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/require-dir/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/require-dir'
 @ ./node_modules/require-dir/index.js 4:9-22
 @ ./node_modules/laravel-elixir/dist/bootstrap/LoadExtensions.js
 @ ./node_modules/laravel-elixir/dist/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/uglify-js/tools/node.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/uglify-js/tools'
 @ ./node_modules/uglify-js/tools/node.js 8:9-22
 @ ./node_modules/html-minifier/src/htmlminifier.js
 @ ./node_modules/gulp-htmlmin/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

ERROR in ./node_modules/vinyl-fs/lib/dest/writeContents/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/me/sites/me/node_modules/vinyl-fs/lib/dest/writeContents'
 @ ./node_modules/vinyl-fs/lib/dest/writeContents/index.js 3:9-22
 @ ./node_modules/vinyl-fs/lib/dest/index.js
 @ ./node_modules/vinyl-fs/index.js
 @ ./node_modules/gulp/index.js
 @ ./node_modules/laravel-elixir-minify-html/index.js
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @ production 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!     /Users/me/.npm/_logs/2019-12-19T08_32_51_796Z-debug.log
me@mine-MacBook-Pro me % npm install --only=prod
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
updated 1 package and audited 22490 packages in 6.359s

24 packages are looking for funding
  run `npm fund` for details

found 16 vulnerabilities (4 low, 5 moderate, 7 high)
  run `npm audit fix` to fix them, or `npm audit` for details
me@mine-MacBook-Pro me %

Is npm that complicated to use?

0 likes
3 replies
george1's avatar

Hi I tried this as well, then run again non run production but I still get the same output.

Nakov's avatar

@george1 remove the node_modules from your project, and run npm install once again.

Please or to participate in this conversation.