اذهب إلى المحتوى
  • 0

لا يتم تثبيت حزمة webpack بداخل مشروعي

Najah Alsaker

السؤال

بعد انشاء جميع الملفات حص مشكلة وحذف ملف webpack.config.js وحذفت معه جميع الاضافة قمت بنسخ نفس الملف من مكان اخر واعادة تثبيت جميع الاضافات حتى ويب باك ثبته بالبداية ولكنه مازال يعطيني خطا عند اعادة تشغيل السيرفر فهمت انه غير متعرف على ويب لذلك حاولت اعادة تثبيته لكنه ايضا اعطاني خطا 

هذه رسالى الخطان

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\coffee>npm run build

> coffee@1.0.0 build C:\coffee
> webpack serve

'webpack' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! coffee@1.0.0 build: `webpack serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the coffee@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\len\AppData\Roaming\npm-cache\_logs\2021-08-09T23_09_03_53
4Z-debug.log

C:\coffee>npm i --save-dev webpack
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellane
ous Warning CERT_NOT_YET_VALID: request to https://registry.npmjs.org/webpack fa
iled, reason: certificate is not yet valid
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a req
uest error during revalidation.
npm WARN optimize-css-assets-webpack-plugin@6.0.1 requires a peer of webpack@^4.
0.0 but none is installed. You must install peer dependencies yourself.
npm WARN coffee@1.0.0 No description

npm ERR! code EEXIST
npm ERR! path C:\coffee\node_modules\.bin\webpack.ps1
npm ERR! Refusing to delete C:\coffee\node_modules\.bin\webpack.ps1: ../webpack/
bin/webpack.js symlink target is not controlled by npm C:\coffee\node_modules\we
bpack
npm ERR! File exists: C:\coffee\node_modules\.bin\webpack.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\len\AppData\Roaming\npm-cache\_logs\2021-08-09T23_10_00_74
9Z-debug.log

C:\coffee>

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 0

حاولي حذف مجلد node_modules و من ثم تنفيذ الأمر التالي 

npm install

لتنزيل الحزم كاملة . ايضا حاولي حذف حزمة webpack من خلال الأمر التالي 

npm unistall webpack

ومن ثم محاولة إعادة تثبيتها من جديد من خلال الأمر التالي 

npm i -D webpack

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0

تأكدي أن C:\coffee> هو مجلد المشروع أولا ثم بعد ذلك قومي بإزالة مجلد node_modules و package.lock.json ثم قومي بإعادة تثبيت المكتبات عن طريق 

npm install

ثم جربي تشغيل الخادم مرة أخرى

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0

يبدو أن لا يتم تثبيت webpack لوجود ملفات قديمة أو ماشابه لذلك قومي بتثبيته ولكن هذه المرة مع إضافة المعامل --force كالتالي

npm i --save-dev webpack --force

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0

يمكنك للتخلص من المشكلة تثبيت webpack بشكل global , تأكد أن تقوم بطباعة الأمر التالي :

npm install -g webpack

أما إذا كان لديك Webpack مثبت محليًا ، ففي حالات خاصة جدا سنحتاج تحديد المكان الذي يجب أن يبحث فيه موجه الأوامر بشكل صريح للعثور عليه ، مثل : 

node_modules\.bin\webpack

يكون هذا في ملف package.json أين يتم تعريف الأوامر ضمن الكائن script (هذا بافتراض أنك داخل دليل المشروع بالفعل وأنك قمت بالفعل بتسطيب الحزمة عن طريق الأمر webpack ) .

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0

تم تثبت جميع الحزم ولكن مازال هناك خطا

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\coffee>npm run build

> ecommerce@1.0.0 build C:\coffee
> webpack serve

(node:3576) [DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning:
optimizeChunkAssets is deprecated (use Compilation.hooks.processAssets instead a
nd use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
(Use `node --trace-deprecation ...` to show where the warning was created)
i ?wds?: Project is running at http://localhost:1239/
i ?wds?: webpack output is served from
i ?wds?: Content not from webpack is served from C:\coffee\dist
x ?wdm?: assets by path *.jpeg 1.32 MiB 12 assets
assets by path *.html 24.3 KiB
  asset product1.html 13.1 KiB [emitted]
  asset index.html 7.68 KiB [emitted]
  asset contact.html 3.47 KiB [emitted]
assets by chunk 680 KiB (name: main)
  asset main.js 520 KiB [emitted] (name: main)
  asset css/style.css 160 KiB [emitted] (name: main)
Entrypoint main 680 KiB = css/style.css 160 KiB main.js 520 KiB
runtime modules 1.25 KiB 6 modules
orphan modules 19.4 KiB [orphan] 1 module
modules by path ./node_modules/ 481 KiB (javascript) 159 KiB (css/mini-extract)
  modules by path ./node_modules/webpack-dev-server/client/ 20.9 KiB 10 modules
  modules by path ./node_modules/html-entities/lib/*.js 61 KiB 5 modules
  modules by path ./node_modules/webpack/hot/ 1.58 KiB 3 modules
  modules by path ./node_modules/url/ 37.4 KiB 3 modules
  modules by path ./node_modules/querystring/*.js 4.51 KiB 3 modules
  modules by path ./node_modules/@laylazi/bootstrap-rtl/dist/css/*.css 50 bytes
(javascript) 159 KiB (css/mini-extract)
    ./node_modules/@laylazi/bootstrap-rtl/dist/css/bootstrap-rtl.min.css 50 byte
s [built]


	    css ./node_modules/css-loader/dist/cjs.js!./node_modules/@laylazi/bootstrap-

	rtl/dist/css/bootstrap-rtl.min.css 159 KiB [built] [code generated]

	modules by path ./src/ 259 bytes (javascript) 3.96 KiB (css/mini-extract)

	  ./src/index.js 209 bytes [built] [code generated]

	  ./src/css/style.css 50 bytes [built] [code generated]

	  css ./node_modules/css-loader/dist/cjs.js!./src/css/style.css 3.96 KiB [built]

	 [code generated]


ERROR in ./node_modules/bootstrap/dist/js/bootstrap.min.js 6:85-110
Module not found: Error: Can't resolve '@popperjs/core' in 'C:\coffee\node_modul
es\bootstrap\dist\js'
resolve '@popperjs/core' in 'C:\coffee\node_modules\bootstrap\dist\js'
  Parsed request is a module
  using description file: C:\coffee\node_modules\bootstrap\package.json (relativ
e path: ./dist/js)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      C:\coffee\node_modules\bootstrap\dist\js\node_modules doesn't exist or is
not a directory
      C:\coffee\node_modules\bootstrap\dist\node_modules doesn't exist or is not
 a directory
      C:\coffee\node_modules\bootstrap\node_modules doesn't exist or is not a di
rectory
      C:\coffee\node_modules\node_modules doesn't exist or is not a directory
      looking for modules in C:\coffee\node_modules
        single file module
          using description file: C:\coffee\package.json (relative path: ./node_
modules/@popperjs/core)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              C:\coffee\node_modules\@popperjs\core doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              C:\coffee\node_modules\@popperjs\core.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              C:\coffee\node_modules\@popperjs\core.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              C:\coffee\node_modules\@popperjs\core.wasm doesn't exist
        C:\coffee\node_modules\@popperjs\core doesn't exist
      looking for modules in C:\node_modules
        single file module
          No description file found in C:\node_modules\@popperjs or above
          no extension
            Field 'browser' doesn't contain a valid alias configuration
            C:\node_modules\@popperjs\core doesn't exist
          .js
            Field 'browser' doesn't contain a valid alias configuration
            C:\node_modules\@popperjs\core.js doesn't exist
          .json
            Field 'browser' doesn't contain a valid alias configuration
            C:\node_modules\@popperjs\core.json doesn't exist
          .wasm
            Field 'browser' doesn't contain a valid alias configuration
            C:\node_modules\@popperjs\core.wasm doesn't exist
        C:\node_modules\@popperjs\core doesn't exist
 @ ./src/index.js 3:0-44

webpack 5.50.0 compiled with 1 error in 12782 ms
i ?wdm?: Failed to compile.

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

  • 0
بتاريخ On 8/24/2021 at 09:14 قال Najah Alsaker:

تم تثبت جميع الحزم ولكن مازال هناك خطا


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\coffee>npm run build

> ecommerce@1.0.0 build C:\coffee
> webpack serve

(node:3576) [DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning:
optimizeChunkAssets is deprecated (use Compilation.hooks.processAssets instead a
nd use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)
(Use `node --trace-deprecation ...` to show where the warning was created)
i ?wds?: Project is running at http://localhost:1239/
i ?wds?: webpack output is served from
i ?wds?: Content not from webpack is served from C:\coffee\dist
x ?wdm?: assets by path *.jpeg 1.32 MiB 12 assets
assets by path *.html 24.3 KiB
  asset product1.html 13.1 KiB [emitted]
  asset index.html 7.68 KiB [emitted]
  asset contact.html 3.47 KiB [emitted]
assets by chunk 680 KiB (name: main)
  asset main.js 520 KiB [emitted] (name: main)
  asset css/style.css 160 KiB [emitted] (name: main)
Entrypoint main 680 KiB = css/style.css 160 KiB main.js 520 KiB
runtime modules 1.25 KiB 6 modules
orphan modules 19.4 KiB [orphan] 1 module
modules by path ./node_modules/ 481 KiB (javascript) 159 KiB (css/mini-extract)
  modules by path ./node_modules/webpack-dev-server/client/ 20.9 KiB 10 modules
  modules by path ./node_modules/html-entities/lib/*.js 61 KiB 5 modules
  modules by path ./node_modules/webpack/hot/ 1.58 KiB 3 modules
  modules by path ./node_modules/url/ 37.4 KiB 3 modules
  modules by path ./node_modules/querystring/*.js 4.51 KiB 3 modules
  modules by path ./node_modules/@laylazi/bootstrap-rtl/dist/css/*.css 50 bytes
(javascript) 159 KiB (css/mini-extract)
    ./node_modules/@laylazi/bootstrap-rtl/dist/css/bootstrap-rtl.min.css 50 byte
s [built]


	    css ./node_modules/css-loader/dist/cjs.js!./node_modules/@laylazi/bootstrap-

	rtl/dist/css/bootstrap-rtl.min.css 159 KiB [built] [code generated]

	modules by path ./src/ 259 bytes (javascript) 3.96 KiB (css/mini-extract)

	  ./src/index.js 209 bytes [built] [code generated]

	  ./src/css/style.css 50 bytes [built] [code generated]

	  css ./node_modules/css-loader/dist/cjs.js!./src/css/style.css 3.96 KiB [built]

	 [code generated]


ERROR in ./node_modules/bootstrap/dist/js/bootstrap.min.js 6:85-110
Module not found: Error: Can't resolve '@popperjs/core' in 'C:\coffee\node_modul
es\bootstrap\dist\js'
resolve '@popperjs/core' in 'C:\coffee\node_modules\bootstrap\dist\js'
  Parsed request is a module
  using description file: C:\coffee\node_modules\bootstrap\package.json (relativ
e path: ./dist/js)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      C:\coffee\node_modules\bootstrap\dist\js\node_modules doesn't exist or is
not a directory
      C:\coffee\node_modules\bootstrap\dist\node_modules doesn't exist or is not
 a directory
      C:\coffee\node_modules\bootstrap\node_modules doesn't exist or is not a di
rectory
      C:\coffee\node_modules\node_modules doesn't exist or is not a directory
      looking for modules in C:\coffee\node_modules
        single file module
          using description file: C:\coffee\package.json (relative path: ./node_
modules/@popperjs/core)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              C:\coffee\node_modules\@popperjs\core doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              C:\coffee\node_modules\@popperjs\core.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              C:\coffee\node_modules\@popperjs\core.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              C:\coffee\node_modules\@popperjs\core.wasm doesn't exist
        C:\coffee\node_modules\@popperjs\core doesn't exist
      looking for modules in C:\node_modules
        single file module
          No description file found in C:\node_modules\@popperjs or above
          no extension
            Field 'browser' doesn't contain a valid alias configuration
            C:\node_modules\@popperjs\core doesn't exist
          .js
            Field 'browser' doesn't contain a valid alias configuration
            C:\node_modules\@popperjs\core.js doesn't exist
          .json
            Field 'browser' doesn't contain a valid alias configuration
            C:\node_modules\@popperjs\core.json doesn't exist
          .wasm
            Field 'browser' doesn't contain a valid alias configuration
            C:\node_modules\@popperjs\core.wasm doesn't exist
        C:\node_modules\@popperjs\core doesn't exist
 @ ./src/index.js 3:0-44

webpack 5.50.0 compiled with 1 error in 12782 ms
i ?wdm?: Failed to compile.

 

يبدوا أن مشكلة تثبيت webpack قد تم تجاوزها . يظهر من الخطأ أنه هنالك مشكلة بتثبيت حزمة popper.js و popperjs core أيضا . 

و ليكن في العلم أن حزمة popper.js هي حزمة يستعملها Bootstrap 4 لإظهار النوافذ المنبثقة و بعض التأثيرات و التفاعليات في بوتستراب. يطلق على popper.js و مثلها من الحزم لفظ peer dependecies , و يقصد بها أي حزمة B تتطلبه حزمة معينة A ما ولكنها لا تشمله مع نفسه عند تثبيته .  

و بسبب عدم تثبيتها أو تثبيتها على نحو خاطئ ,  نواجه مثل هاته الأخطاء التي تخبرنا أن واحدة من الحزم تتطلب حزمة أخرى  .

و لذلك سنحتاج أيضا تثبيت popper.js بشكل مستقل , لنقم بتنفيذ الأمر : 

npm install popper.js --save

أما ان كنت تستعملين نسخ x.5 من بوتستراب فسيتطلب عليك تثبيت popperjs core عوضا عن popper.js , لنتأكد عندها من تثبيت الحزمة عن طريق الأمر : 

npm install @popperjs/core --save

ثم سيكون عليك أخيرا تشغيل أمر البناء مجددا : 

npm run build

إن استمرت مشكلتك بالظهور يرجى إخباري بشأن أيضا أخطاء تظهر . 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...