質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.51%
npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

Q&A

解決済

1回答

9374閲覧

npm run devが上手く行かない

gunners6518

総合スコア16

npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

0グッド

2クリップ

投稿2019/08/04 09:14

#背景

Laravelとvue.jsを使ってチャットのwebサービスを作っていました。
こちらのサイトを参考にしております。
https://dev.to/mezie/how-to-build-a-laravel-chat-app-with-pusher-2e2o

laravel-echoとpusherを使ったリアルタイムチャットです。

eventの作成など一通り終わった後で、Laravel Mixを使ってJavaScriptファイルをコンパイルしようとした所で以下のようなエラーが出ました。

エラーコードを読んだ感じだとコンパイルに失敗していて./resources/sass/app.scssにエラーがあるとの事なのですが、特にapp.scssは弄った覚えがないです。

##エラーコード

xxxMacBook:laravel_chat xxx$ npm run dev > @ dev /Users/xxx/Desktop/laravel_chat > npm run development > @ development /Users/xxx/Desktop/laravel_chat > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 98% after emitting SizeLimitsPlugin ERROR Failed to compile with 2 errors 16:01:00 error in ./resources/sass/app.scss Module build failed (from ./node_modules/css-loader/index.js): ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js): @import "utilities/clearfix"; ^ Can't find stylesheet to import. ╷ 4 │ @import "utilities/clearfix"; │ ^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/bootstrap/scss/_utilities.scss 4:9 @import node_modules/bootstrap/scss/bootstrap.scss 43:9 @import stdin 8:9 root stylesheet in error in ./resources/sass/app.scss Module build failed (from ./node_modules/sass-loader/lib/loader.js): @import "utilities/clearfix"; ^ Can't find stylesheet to import. ╷ 4 │ @import "utilities/clearfix"; │ ^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/bootstrap/scss/_utilities.scss 4:9 @import node_modules/bootstrap/scss/bootstrap.scss 43:9 @import stdin 8:9 root stylesheet in /Users/xxx/Desktop/laravel_chat/node_modules/bootstrap/scss/_utilities.scss (line 4, column 9) @ ./resources/sass/app.scss 2:14-255 Asset Size Chunks Chunk Names /js/app.js 1.68 MiB /js/app [emitted] /js/app ERROR in ./resources/sass/app.scss Module build failed (from ./node_modules/css-loader/index.js): ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js): @import "utilities/clearfix"; ^ Can't find stylesheet to import. ╷ 4 │ @import "utilities/clearfix"; │ ^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/bootstrap/scss/_utilities.scss 4:9 @import node_modules/bootstrap/scss/bootstrap.scss 43:9 @import stdin 8:9 root stylesheet ERROR in ./resources/sass/app.scss (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./node_modules/resolve-url-loader??ref--5-4!./node_modules/sass-loader/lib/loader.js??ref--5-5!./resources/sass/app.scss) Module build failed (from ./node_modules/sass-loader/lib/loader.js): @import "utilities/clearfix"; ^ Can't find stylesheet to import. ╷ 4 │ @import "utilities/clearfix"; │ ^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/bootstrap/scss/_utilities.scss 4:9 @import node_modules/bootstrap/scss/bootstrap.scss 43:9 @import stdin 8:9 root stylesheet in /Users/xx/Desktop/laravel_chat/node_modules/bootstrap/scss/_utilities.scss (line 4, column 9) @ ./resources/sass/app.scss 2:14-255 npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js` npm ERR! Exit status 2 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! /Users/xxx/.npm/_logs/2019-08-04T07_01_02_384Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ dev: `npm run development` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ dev 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! /Users/xxx/.npm/_logs/2019-08-04T07_01_02_409Z-debug.log

##app.scss

// Fonts @import url('https://fonts.googleapis.com/css?family=Nunito'); // Variables @import 'variables'; // Bootstrap @import '~bootstrap/scss/bootstrap';

##app.js

/** * First we will load all of this project's JavaScript dependencies which * includes Vue and other libraries. It is a great starting point when * building robust, powerful web applications using Vue and Laravel. */ require('./bootstrap'); window.Vue = require('vue'); /** * The following block of code may be used to automatically register your * Vue components. It will recursively scan this directory for the Vue * components and automatically register them with their "basename". * * Eg. ./components/ExampleComponent.vue -> <example-component></example-component> */ // const files = require.context('./', true, /.vue$/i); // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default)); Vue.component('chat-messages', require('./components/ChatMessages.vue')); Vue.component('chat-form', require('./components/ChatForm.vue')); /** * Next, we will create a fresh Vue application instance and attach it to * the page. Then, you may begin adding components to this application * or customize the JavaScript scaffolding to fit your unique needs. */ const app = new Vue({ el: '#app', data: { messages:[] }, created() { this.fetchMessages(); Echo.private('chat') .listen('MessageSent', (e) => { this.message.push({ message: e.message.message, user: e.user }); }); }, methods: { fetchMessages() { axions.get('/messages').then(response => { this.messages = response.data; }); }, addMessage(message) { this.message.push(message); axios.post('/messages', message).then(response => { console.log(response.data); }); } } });

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

app.scss自体ではなく,そこでimportされている `~bootstrap/scss/bootstrap' の方でエラーが起こっているように見えます。
おそらく"utilities/clearfix"のパスが解決できていないのだと思われます

投稿2019/08/04 17:04

u-sho

総合スコア110

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.51%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問