PacktPublishing / Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition

Learning JavaScript Data Structures and Algorithms (Third Edition), published by Packt
MIT License
1.06k stars 430 forks source link

"TypeError: Cannot read property 'properties' of undefined" webpack-cli error fix #2

Closed cfree closed 5 years ago

cfree commented 5 years ago

I ran npm run dev and got this error:

...
> webpack --env build

/Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition/LearningJavaScriptDataStructuresandAlgorithmsThirdEdition_Code/node_modules/webpack-cli/bin/config-yargs.js:136
                describe: optionsSchema.definitions.output.properties.path.description,
                                                           ^

TypeError: Cannot read property 'properties' of undefined
    at module.exports (/Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition/LearningJavaScriptDataStructuresandAlgorithmsThirdEdition_Code/node_modules/webpack-cli/bin/config-yargs.js:136:48)
    at /Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition/LearningJavaScriptDataStructuresandAlgorithmsThirdEdition_Code/node_modules/webpack-cli/bin/webpack.js:66:27
    at Object.<anonymous> (/Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition/LearningJavaScriptDataStructuresandAlgorithmsThirdEdition_Code/node_modules/webpack-cli/bin/webpack.js:521:3)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! javascript-datastructures-algorithms@0.0.1 webpack: `webpack --env build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the javascript-datastructures-algorithms@0.0.1 webpack 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/cfree/.npm/_logs/2018-12-15T18_04_10_202Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command

I updated to 3.x of webpack-cli, which resulted in this error:

...
> webpack --env build

/Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition/LearningJavaScriptDataStructuresandAlgorithmsThirdEdition_Code/node_modules/webpack-cli/bin/cli.js:244
                throw err;
                ^

Error: Cannot find module 'uglifyjs-webpack-plugin'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    ...

I ran npm install -D uglifyjs-webpack-plugin and it worked! :tada:

loiane commented 5 years ago

Hi @cfree, pls get latest code from https://github.com/loiane/javascript-datastructures-algorithms - it is using webpack 4.

githubce commented 5 years ago

Solution to the query is provided by @loiane