ionic-team / stencil

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
https://stenciljs.com
Other
12.55k stars 784 forks source link

WINDOWS Build Error EPERM: operation not permitted, copyfile #2609

Open mmakrzem opened 4 years ago

mmakrzem commented 4 years ago

Stencil version:

 @stencil/core@1.17.2

I'm submitting a:

[X] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior: stencil doesn't remove old read-only files that it copied to the www folder before it tries to copy them again on a subsequent run, thus an EPERM error happens on Windows.

Expected behavior: Read only files should be handled correctly by the build system.

Steps to reproduce: Copy the project found in: https://github.com/mmakrzem/stencilCopyBug

mark the file found in src/assets/images/readOnlyImage.jpg as being read-only

npm i

npm run start

stop the running session

npm run start

On the 2nd run, you will see the build error:

Build Error EPERM: operation not permitted, copyfile 'C:\st-1-17-2-copyBug\src\assets\images\readOnlyImage.jpg' -> 'C:\st-1-17-2-copyBug\www\assets\images\readOnlyImage.jpg'

mmakrzem commented 4 years ago

I filed this bug a while ago here: https://github.com/ionic-team/stencil/issues/2235 It was claimed to be fixed, but the problem is still occurring and isn't fixed

Ezylpro commented 4 years ago

hey, i was having this issue, when using vue.js, everytime i runned 'npm run dev' or 'npm run watch' this error appears, im using docker server, stopping it before run 'npm run dev' worked for me

Ezylpro commented 4 years ago

hope you understood what i said

ranjanngc commented 3 years ago

Getting same issue Code:

const fs = require('fs');

fs.copyFile('./dist/frontend.controls.0.0.1.umd.min.js', './../../dist/content/lib/asi/js/', (err) => {
  if (err) throw err;
  console.log('frontend.controls.0.0.1.umd.min.js was copied to destination.txt');
});

Error:

[Error: EPERM: operation not permitted, copyfile 'D:\Foundation.Web\src\frontend-control-library\dist\frontend.controls.0.0.1.umd.min.js' -> 'D:\Foundation.Web\dist\content\lib\asi\js'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'copyfile',
  path: 'D:\\Foundation.Web\\src\\frontend-control-library\\dist\\frontend.controls.0.0.1.umd.min.js',
  dest: 'D:\\Foundation.Web\\dist\\content\\lib\\asi\\js'
}
OriginZero commented 3 years ago

It may be that the file is being used

rwaskiewicz commented 11 months ago

It seems that when copying an asset, Stencil doesn't remove the 'readonly' flag on the file. This results in a failure (I believe) due to trying to overwrite a readonly file (that was placed in www/assets/images/) on the first build