File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,11 +71,18 @@ For more information, see https://webpack.js.org/api/cli/.`);
7171 options = require ( "./utils/convert-argv" ) ( argv ) ;
7272 } catch ( err ) {
7373 // When webpack is not installed and no args passed to the CLI
74- if ( err . code === "MODULE_NOT_FOUND" && err . message === "Cannot find module 'webpack-sources'" ) {
75- console . error (
76- "\n\u001b[31mwebpack not found, please install webpack using\n\t\u001b[33mnpm install --save-dev webpack\n"
77- ) ;
74+ if ( err . code === "MODULE_NOT_FOUND" ) {
75+ let errorMessage =
76+ "\n\u001b[31mwebpack not found, please install webpack using\n\t\u001b[33mnpm install --save-dev webpack\n" ;
77+
78+ if ( process . env . npm_execpath !== undefined ) {
79+ if ( process . env . npm_execpath . indexOf ( "yarn" ) !== - 1 ) {
80+ errorMessage =
81+ "\n\u001b[31mwebpack not found, please install webpack using\n\t\u001b[33myarn add webpack --dev\n" ;
82+ }
83+ }
7884
85+ console . error ( errorMessage ) ;
7986 return ;
8087 }
8188
You can’t perform that action at this time.
0 commit comments