Laravel-mix: Laravel mix version causes error when used with copyDirectory

Created on 12 Aug 2019  路  2Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 4.1.2
  • Node Version : v8.11.4
  • NPM Version: 6.10.2
  • OS: Windows 10 64bit

Description:

Error: Source and destination must not be the same.

Steps To Reproduce:

in webpack.mix.js

mix.copyDirectory('resources/images', 'public/images');

mix
    .js('resources/js/script.js', 'public/js')
    .sass('resources/sass/style.scss', 'public/css')
    .version();

then i ran npm run prod

output dump

 npm run production

> @ production D:\Projects\huepfburg
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js



 DONE  Compiled successfully in 48961ms                                                                                                                            11:14:12

Error: Source and destination must not be the same.
    at checkPaths (D:\Projects\huepfburg\node_modules\fs-extra\lib\copy-sync\copy-sync.js:185:11)
    at copyDirItem (D:\Projects\huepfburg\node_modules\fs-extra\lib\copy-sync\copy-sync.js:117:20)
    at fs.readdirSync.forEach.item (D:\Projects\huepfburg\node_modules\fs-extra\lib\copy-sync\copy-sync.js:111:39)
    at Array.forEach (<anonymous>)
    at copyDir (D:\Projects\huepfburg\node_modules\fs-extra\lib\copy-sync\copy-sync.js:111:23)
    at onDir (D:\Projects\huepfburg\node_modules\fs-extra\lib\copy-sync\copy-sync.js:101:10)
    at getStats (D:\Projects\huepfburg\node_modules\fs-extra\lib\copy-sync\copy-sync.js:43:37)
    at startCopy (D:\Projects\huepfburg\node_modules\fs-extra\lib\copy-sync\copy-sync.js:36:10)
    at Object.copySync (D:\Projects\huepfburg\node_modules\fs-extra\lib\copy-sync\copy-sync.js:31:10)
    at File.copyTo (D:\Projects\huepfburg\node_modules\laravel-mix\src\File.js:191:12)
    at FileCollection.copyTo (D:\Projects\huepfburg\node_modules\laravel-mix\src\FileCollection.js:83:24)
    at src.forEach.file (D:\Projects\huepfburg\node_modules\laravel-mix\src\FileCollection.js:77:38)
    at Array.forEach (<anonymous>)
    at FileCollection.copyTo (D:\Projects\huepfburg\node_modules\laravel-mix\src\FileCollection.js:77:17)
    at CopyFilesTask.run (D:\Projects\huepfburg\node_modules\laravel-mix\src\tasks\CopyFilesTask.js:15:20)
    at CustomTasksPlugin.runTask (D:\Projects\huepfburg\node_modules\laravel-mix\src\webpackPlugins\CustomTasksPlugin.js:35:14)
    at Mix.tasks.forEach.task (D:\Projects\huepfburg\node_modules\laravel-mix\src\webpackPlugins\CustomTasksPlugin.js:11:44)
    at Array.forEach (<anonymous>)
    at compiler.plugin.stats (D:\Projects\huepfburg\node_modules\laravel-mix\src\webpackPlugins\CustomTasksPlugin.js:11:23)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\Projects\huepfburg\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:18:1)
    at AsyncSeriesHook.lazyCompileHook (D:\Projects\huepfburg\node_modules\tapable\lib\Hook.js:154:20)
    at emitRecords.err (D:\Projects\huepfburg\node_modules\webpack\lib\Compiler.js:267:22)
    at Compiler.emitRecords (D:\Projects\huepfburg\node_modules\webpack\lib\Compiler.js:449:39)
    at emitAssets.err (D:\Projects\huepfburg\node_modules\webpack\lib\Compiler.js:261:10)
    at hooks.afterEmit.callAsync.err (D:\Projects\huepfburg\node_modules\webpack\lib\Compiler.js:435:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\Projects\huepfburg\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (D:\Projects\huepfburg\node_modules\tapable\lib\Hook.js:154:20)
    at asyncLib.forEachLimit.err (D:\Projects\huepfburg\node_modules\webpack\lib\Compiler.js:432:27)
    at D:\Projects\huepfburg\node_modules\neo-async\async.js:2818:7
    at done (D:\Projects\huepfburg\node_modules\neo-async\async.js:3522:9)
    at D:\Projects\huepfburg\node_modules\graceful-fs\graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:135:15)
stale

Most helpful comment

Just delete images directory from public and run compile again.

All 2 comments

Just delete images directory from public and run compile again.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

terion-name picture terion-name  路  3Comments

mstralka picture mstralka  路  3Comments

pixieaka picture pixieaka  路  3Comments

Bomavi picture Bomavi  路  3Comments

rlewkowicz picture rlewkowicz  路  3Comments