2017-02-01 6 views
2

私はlaravel 5.4を使用しています。エスキシックをセットアップしてsassファイルをコンパイルしたかったのです。私は$ npm installを実行して、万能薬をインストールしようとし、その後、私は$ gulpを実行しようとしたが、それは私に次のエラーました:const elixir = require('laravel-elixir');を追加した後エリクシールが定義されていないエラー

/home/vagrant/Code/Laravel/gulpfile.js:1 
(function (exports, require, module, __filename, __dirname) { elixir(mix => { 
                  ^

ReferenceError: elixir is not defined 
    at Object.<anonymous> (/home/vagrant/Code/Laravel/gulpfile.js:1:63) 
    at Module._compile (module.js:570:32) 
    at Object.Module._extensions..js (module.js:579:10) 
    at Module.load (module.js:487:32) 
    at tryModuleLoad (module.js:446:12) 
    at Function.Module._load (module.js:438:3) 
    at Module.require (module.js:497:17) 
    at require (internal/module.js:20:19) 
    at execute (/usr/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/index.js:24:18) 
    at Liftoff.handleArguments (/usr/lib/node_modules/gulp-cli/index.js:149:63) 

を、私はこのエラーを取得しています:

[02:28:30] Starting 'webpack'... 
{ [Error: ./resources/assets/js/components/Example.vue 
Module parse failed: /home/vagrant/Code/Laravel/resources/assets/js/components/Example.vue Unexpected token (1:0) 
You may need an appropriate loader to handle this file type. 
| <template> 
|  <div class="container"> 
|   <div class="row"> 
@ ./resources/assets/js/app.js 16:25-60] 
    message: './resources/assets/js/components/Example.vue\nModule parse failed: /home/vagrant/Code/Laravel/resources/assets/js/components/Example.vue Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type.\n| <template>\n|  <div class="container">\n|   <div class="row">\n @ ./resources/assets/js/app.js 16:25-60', 
    showStack: false, 
    showProperties: true, 
    plugin: 'webpack-stream', 
    __safety: { toString: [Function: bound ] } } 
+0

: 'のconst {エリクシル} =必要( 'laravel-エリキシルあなたは下のサンプルを参照してくださいrequire('laravel-elixir-vue-2');必要とする必要があります'); ' – PaladiN

+0

どのファイルですか? @PaladiN – ottsharp13

+0

'Webpack.mix.js'から上記のインポートを使用していて、' gulpfile.js'を使用している場合(あなたが使用しているように) 'const elixir = require( 'laravel-elixir' ); ' – PaladiN

答えて

2

私が持っています新しいlaravelアプリケーションをインストールするときと同じ問題5.4。 gulp webpackを実行しようとすると、コンソールに同じエラーが表示されます。だから、私がしたことは、laravel 5.4には新しいバージョンのバージョンが付属しているからです。これはvue 2です。あなたのようにあなたのインポートリストに万能薬を追加する必要があるかもしれません

gulpfile.js

var elixir = require('laravel-elixir'); 
require('laravel-elixir-vue-2'); // recommended for vue 2 
elixir(function(mix) { 
    // some mixes here.. 
    mix.webpack('app.js'); 
}); 

If you got errors like elixir related, just npm install them. also check this page here .

関連する問題