File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -71,11 +71,18 @@ For more information, see https://webpack.js.org/api/cli/.`);
71
71
options = require ( "./utils/convert-argv" ) ( argv ) ;
72
72
} catch ( err ) {
73
73
// 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
+ }
78
84
85
+ console . error ( errorMessage ) ;
79
86
return ;
80
87
}
81
88
You can’t perform that action at this time.
0 commit comments