مجهول
  • 0

ممكن حل مشكلة Uncaught Error: Module parse failed: Unexpected token ؟

  • 0

لدي مشكل في تنفيد السطر التالي : npm run watch

يظهر المشكلة التالية : Uncaught Error: Module parse failed: Unexpected token

تظهر في الـ console التالي :

Uncaught Error: Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

وبعد القيام ببعض التعديلات التي وجدت في الأنترنيت ظهر التالي في الconsole :

> @ development C:\\xampp\\htdocs\\bla > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js –progress –config=node_modules/laravel-mix/setup/webpack.config.js “–watch”

Additional dependencies must be installed. This will only take a moment.

Running: npm install vue-loader@^15.9.7 –save-dev –legacy-peer-deps

Finished. Please run Mix again.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js –progress –config=node_modules/laravel-mix/setup/webpack.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\\mylap\\AppData\\Roaming\\npm-cache\\_logs\\2021-10-28T21_59_19_855Z-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\\mylap\\AppData\\Roaming\\npm-cache\\_logs\\2021-10-28T21_59_19_962Z-debug.log

ممكن حل لشخص متمكن في البرمجة والـ laravel

 

 

  1. لقد واجهتني المشكلة من قبل و كان حلها عويص و لكنها تحل و سوف أشرح لك الأمر من المصادر التالية 1 و 2  :

    في ملف package.json قم بالتغييرات التالية :

    “laravel-mix”: “^6.0.10”,
    “vue-loader”: “^15.9.6”,
    “vue-template-compiler”: “^2.6.12”,
    “vue”: “^2.6.12”

    و في ملف الـ webpack.mix.js قم بالتغيير التالي :

    في الأول يكون هكذا :

    mix.js(‘resources/js/app.js’, ‘public/js’)
    .sass(‘resources/sass/app.scss’, ‘public/css’);

    أنت قم بتغييره ليصبح هكذا :

    mix.js(‘resources/js/app.js’, ‘public/js’).vue({ version: 2 })
    ;sass(‘resources/sass/app.scss’, ‘public/css’).

    وقم بتغيير التالي في ملف الـ app.js

    window.Vue = require(‘vue’).default;

    بعد ذلك قم بتشغيل سطر الأمر npm run watch و سوف تشتغل معك .

    وإذا لم تشتغل قم بعمل الأوامر التالية واحد بعد الواحد :

    npm install vue-resource

    npm i vue-loader

    npm install vue-template-compiler

    npm install vue-router

    النتيجة تظهر كالتالي إذا لم تواجهك مشاكل :

    Mix: Compiled successfully in 21.59s
    webpack compiled successfully

    • 0
أضف اجابة

أضف اجابة

‫تصفح