menu

Questions & Answers

Why laravel mix copy function does not work?

im tryng to make a copy of a js file that exist in node_modules to the public folder to try to use the javascript files on node_modules only when i need in specific parts of the system.

when i try to make a copy using mix.copy('node_modules/select2/dist/select2.min.js', 'public/vendor/js/'). the error i get is:

[webpack-cli] [Error: ENOENT: no such file or directory, lstat 'C:\laragon\www\project\node_modules\select2\dist\select2.min.js'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'lstat',
  path: 'C:\\laragon\\www\\project\\node_modules\\select2\\dist\\select2.min.js'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `mix`
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!     C:\Users\OfficeUser\AppData\Roaming\npm-cache\_logs\2023-01-10T15_51_48_679Z-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!     C:\Users\OfficeUser\AppData\Roaming\npm-cache\_logs\2023-01-10T15_51_48_721Z-debug.log

What should i do now, is the file path incorrectly written?

Comments:
2023-01-11 09:29:37
did u run npm i?
2023-01-11 09:29:37
Does the directory 'public/vendor/js/' exist?
Answers(0) :