mardi 27 février 2018

Laravel webpack.mix - Error when using copy()

This is my webpack.mix:

let mix = require('laravel-mix');
mix.copyDirectory('resources/assets/bower/card-js/src', 'public/plugins/card-js');

When I run npm run dev the dir is copied, but after before the commands ends I get this error:

C:\Apache24\desarrollo\facturador\node_modules\graceful-fs\polyfills.js:144
        throw er
        ^

Error: ENOENT: no such file or directory, read
    at Object.fs.readSync (fs.js:675:18)
    at Object.readSync (C:\Apache24\desarrollo\facturador\node_modules\graceful-fs\polyfills.js:138:28)
    at copyFileSync (C:\Apache24\desarrollo\facturador\node_modules\fs-extra\lib\copy-sync\copy-file-sync.js:28:20)
    at copySync (C:\Apache24\desarrollo\facturador\node_modules\fs-extra\lib\copy-sync\copy-sync.js:43:5)
    at contents.forEach.content (C:\Apache24\desarrollo\facturador\node_modules\fs-extra\lib\copy-sync\copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at copySync (C:\Apache24\desarrollo\facturador\node_modules\fs-extra\lib\copy-sync\copy-sync.js:51:14)
    at contents.forEach.content (C:\Apache24\desarrollo\facturador\node_modules\fs-extra\lib\copy-sync\copy-sync.js:54:7)
    at Array.forEach (<anonymous>)
    at Object.copySync (C:\Apache24\desarrollo\facturador\node_modules\fs-extra\lib\copy-sync\copy-sync.js:51:14)
    at File.copyTo (C:\Apache24\desarrollo\facturador\node_modules\laravel-mix\src\File.js:210:12)
    at FileCollection.copyTo (C:\Apache24\desarrollo\facturador\node_modules\laravel-mix\src\FileCollection.js:88:24)
    at src.forEach.file (C:\Apache24\desarrollo\facturador\node_modules\laravel-mix\src\FileCollection.js:82:38)
    at Array.forEach (<anonymous>)
    at FileCollection.copyTo (C:\Apache24\desarrollo\facturador\node_modules\laravel-mix\src\FileCollection.js:82:17)
    at CopyFilesTask.run (C:\Apache24\desarrollo\facturador\node_modules\laravel-mix\src\tasks\CopyFilesTask.js:14:20)
    at CustomTasksPlugin.runTask (C:\Apache24\desarrollo\facturador\node_modules\laravel-mix\src\plugins\CustomTasksPlugin.js:34:14)
    at Mix.tasks.forEach.task (C:\Apache24\desarrollo\facturador\node_modules\laravel-mix\src\plugins\CustomTasksPlugin.js:9:44)
    at Array.forEach (<anonymous>)
    at Compiler.compiler.plugin.stats (C:\Apache24\desarrollo\facturador\node_modules\laravel-mix\src\plugins\CustomTasksPlugin.js:9:23)
    at Compiler.applyPlugins (C:\Apache24\desarrollo\facturador\node_modules\tapable\lib\Tapable.js:61:14)
    at emitRecords.err (C:\Apache24\desarrollo\facturador\node_modules\webpack\lib\Compiler.js:264:11)
    at Compiler.emitRecords (C:\Apache24\desarrollo\facturador\node_modules\webpack\lib\Compiler.js:371:38)
    at emitAssets.err (C:\Apache24\desarrollo\facturador\node_modules\webpack\lib\Compiler.js:258:10)
    at applyPluginsAsyncSeries1.err (C:\Apache24\desarrollo\facturador\node_modules\webpack\lib\Compiler.js:364:12)
    at next (C:\Apache24\desarrollo\facturador\node_modules\tapable\lib\Tapable.js:218:11)
    at Compiler.compiler.plugin (C:\Apache24\desarrollo\facturador\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (C:\Apache24\desarrollo\facturador\node_modules\tapable\lib\Tapable.js:222:13)
    at Compiler.afterEmit (C:\Apache24\desarrollo\facturador\node_modules\webpack\lib\Compiler.js:361:9)
    at require.forEach.err (C:\Apache24\desarrollo\facturador\node_modules\webpack\lib\Compiler.js:350:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/we
bpack.config.js`
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.

I have reinstalled nodejs and npm a couple of times and the error persists, but just for copy() and copyDirectory(). For example, if I have this:

let mix = require('laravel-mix');
mix.sass('resources/assets/sass/theme.scss', 'public/css/theme.css');

If I run npm run dev everything compiled correctly without errors. I just need a little help in find why is not compiling when coping content. Thank you in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire