farshadms
4 سال پیش توسط farshadms مطرح شد
1 پاسخ

ارور در اجرای دستور npm run watch

> @ watch C:\Users\Poya\amlakm8
> npm run development -- --watch

> @ development C:\Users\Poya\amlakm8
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

C:\Users\Poya\amlakm8\node_modules\webpack-cli\bin\cli.js:93
                                throw err;
                                ^

TypeError: Cannot read property 'js' of undefined
    at Object.<anonymous> (C:\Users\Poya\amlakm8\webpack.mix.js:14:5)
    at Module._compile (C:\Users\Poya\amlakm8\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (C:\Users\Poya\amlakm8\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
    at Object.<anonymous> (C:\Users\Poya\amlakm8\node_modules\laravel-mix\setup\webpack.config.js:12:1)
    at Module._compile (C:\Users\Poya\amlakm8\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (C:\Users\Poya\amlakm8\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
    at WEBPACK_OPTIONS (C:\Users\Poya\amlakm8\node_modules\webpack-cli\bin\utils\convert-argv.js:114:13)
    at requireConfig (C:\Users\Poya\amlakm8\node_modules\webpack-cli\bin\utils\convert-argv.js:116:6)
    at C:\Users\Poya\amlakm8\node_modules\webpack-cli\bin\utils\convert-argv.js:123:17
    at Array.forEach (<anonymous>)
    at module.exports (C:\Users\Poya\amlakm8\node_modules\webpack-cli\bin\utils\convert-argv.js:121:15)
    at C:\Users\Poya\amlakm8\node_modules\webpack-cli\bin\cli.js:71:45
    at Object.parse (C:\Users\Poya\amlakm8\node_modules\webpack-cli\node_modules\yargs\yargs.js:576:18)
    at C:\Users\Poya\amlakm8\node_modules\webpack-cli\bin\cli.js:49:8
    at Object.<anonymous> (C:\Users\Poya\amlakm8\node_modules\webpack-cli\bin\cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\Poya\amlakm8\node_modules\webpack\bin\webpack.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
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/webpa
ck.config.js "--watch"`
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!     C:\Users\Poya\AppData\Roaming\npm-cache\_logs\2020-09-12T14_08_15_495Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `npm run development -- --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch 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!     C:\Users\Poya\AppData\Roaming\npm-cache\_logs\2020-09-12T14_08_15_660Z-debug.log

ثبت پرسش جدید
محمدحسن یگانه
تخصص : Full-Stack Web Developer Freel...
@mhyeganeh 4 سال پیش آپدیت شد
1

متغیر mix رو نمیشناسه و به همین خاطر متد .js() رو هم نمیتونه روش اجرا کنه. فایل webpack.mix.js تون رو چک کنید. احتمالا مشکل از خط اولش هست و باید مثل کد زیر باشه:

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

https://stackoverflow.com/questions/43685777/laravel-mix-sh-1-cross-env-not-found-error


برای ارسال پاسخ لازم است وارد شده یا ثبت‌نام کنید

ورود یا ثبت‌نام