[英]Laravel mix, cannot `npm run dev` after installing tempusdominus-bs4
I'm having trouble installing tempusdominus-bs4
in my Laravel application.我在我的 Laravel 应用程序中安装tempusdominus-bs4
时遇到问题。 I've followed these steps:我已按照以下步骤操作:
npm install moment --save
安装 Moment JS 与npm install moment --save
npm install tempusdominus-bs4 --save
使用npm install tempusdominus-bs4 --save
app.js
file by adding these lines:通过添加以下行修改了app.js
文件:window.moment = require('moment');
window.datetimepicker = require('tempusdominus-bootstrap-4');
app.scss
file by adding the following line: @import '~tempusdominus-bootstrap-4/src/sass/tempusdominus-bootstrap-4-build';
通过添加以下行来app.scss
文件: @import '~tempusdominus-bootstrap-4/src/sass/tempusdominus-bootstrap-4-build';
After doing all of that i run npm run dev
and the following error appears:完成所有这些后,我运行npm run dev
并出现以下错误:
ERROR in ./resources/sass/app.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
╷
2 │ @import "../../node_modules/bootstrap/scss/_functions.scss";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules/tempusdominus-bootstrap-4/src/sass/tempusdominus-bootstrap-4-build.scss 2:9 @import
resources/sass/app.scss 23:9 root stylesheet
at processResult (/var/www/html/node_modules/webpack/lib/NormalModule.js:676:19)
at /var/www/html/node_modules/webpack/lib/NormalModule.js:778:5
at /var/www/html/node_modules/loader-runner/lib/LoaderRunner.js:399:11
at /var/www/html/node_modules/loader-runner/lib/LoaderRunner.js:251:18
at context.callback (/var/www/html/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
at /var/www/html/node_modules/sass-loader/dist/index.js:54:7
at Function.call$2 (/var/www/html/node_modules/sass/sass.dart.js:92571:16)
at _render_closure1.call$2 (/var/www/html/node_modules/sass/sass.dart.js:81074:12)
at _RootZone.runBinary$3$3 (/var/www/html/node_modules/sass/sass.dart.js:27256:18)
at _FutureListener.handleError$1 (/var/www/html/node_modules/sass/sass.dart.js:25812:19)
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack compiled with 2 errors
I'm using Bootstrap version 4.6, and all the files and folders required are present in the node_package
folder.我使用的是 Bootstrap 4.6 版,所有需要的文件和文件夹都存在于node_package
文件夹中。 I've also tried to run npm ci
but nothing worked.我也尝试过运行npm ci
但没有任何效果。
Do you have any suggestion on how could i fix the error?您对我如何解决错误有什么建议吗?
I've managed to fix the error just by using the following import inside the app.scss
file我已经设法通过在app.scss
文件中使用以下导入来修复错误
@import '~tempusdominus-bootstrap-4/src/sass/tempusdominus-bootstrap-4';
i just needed to remove -build
from the string.我只需要从字符串中删除-build
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.