1
votes

cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

/Users/xwu33/src/bioproc/node_modules/webpack-cli/bin/cli.js:93 throw err; ^

TypeError: Cannot read property 'js' of undefined at Object. (/Users/xwu33/src/bioproc/webpack.mix.js:16:3) at Module._compile (/Users/xwu33/src/bioproc/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (/Users/xwu33/src/bioproc/node_modules/v8-compile-cache/v8-compile-cache.js:161:20) at Object. (/Users/xwu33/src/bioproc/node_modules/laravel-mix/setup/webpack.config.js:12:1) at Module._compile (/Users/xwu33/src/bioproc/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (/Users/xwu33/src/bioproc/node_modules/v8-compile-cache/v8-compile-cache.js:161:20) at WEBPACK_OPTIONS (/Users/xwu33/src/bioproc/node_modules/webpack-cli/bin/utils/convert-argv.js:116:13) at requireConfig (/Users/xwu33/src/bioproc/node_modules/webpack-cli/bin/utils/convert-argv.js:118:6) at /Users/xwu33/src/bioproc/node_modules/webpack-cli/bin/utils/convert-argv.js:125:17 at Array.forEach () at module.exports (/Users/xwu33/src/bioproc/node_modules/webpack-cli/bin/utils/convert-argv.js:123:15) at yargs.parse (/Users/xwu33/src/bioproc/node_modules/webpack-cli/bin/cli.js:71:45) at Object.parse (/Users/xwu33/src/bioproc/node_modules/webpack-cli/node_modules/yargs/yargs.js:567:18) at /Users/xwu33/src/bioproc/node_modules/webpack-cli/bin/cli.js:49:8 at Object. (/Users/xwu33/src/bioproc/node_modules/webpack-cli/bin/cli.js:390:3) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object. (/Users/xwu33/src/bioproc/node_modules/webpack/bin/webpack.js:156:2) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ development 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/xwu33/.npm/_logs/2019-06-21T17_03_18_125Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ dev: npm run development npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ 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! /Users/xwu33/.npm/_logs/2019-06-21T17_03_18_244Z-debug.log

2
Is this on a fresh Laravel install, or have you added a bunch of changes to it? What's your node version?ceejayoz
node version is v10.15.2improve
I have added a brunch of changes to this project, fresh laravel project works fine. I tried to delete package-lock.json file and run: npm install then npm run dev, but it is the same error.improve
If a fresh Laravel works fine, and this one doesn't, that would seem to indicate your code/modifications are at fault. Given that you haven't shared them, this is hard to assist you with.ceejayoz
When I created a fresh laravel project. It is the same npm run dev error though.improve

2 Answers

4
votes

When I changed webpack.mix.js file like this:

// TypeError: Cannot read property 'js' of undefined

const { mix } = require('laravel-mix');

// work

const mix = require('laravel-mix');

Then it works for me!

2
votes

Removed node_modules, then npm install --global cross-env, followed by removing cross-env from package.json, then npm run dev worked.