jvandemo / generator-angular2-library

Yeoman generator to create an Angular library
MIT License
752 stars 122 forks source link

npm run playground permission issue #228

Open minhchau2236 opened 7 years ago

minhchau2236 commented 7 years ago

Hi, I'm using 'npm run playground' to test the library, but I'am facing this issue in windows 10. Error: EPERM: operation not permitted, lstat 'C:\MinhData\Source\PenetraceFrontendFoundation.tmp' .... It seems like problem with permission, so I have set full control to source root directory but it not works. Please give me some solution for this issue?

UncleDave commented 6 years ago

I had this issue myself, I believe the problem is the concurrent task execution:

"playground": "concurrently \"npm run build:watch\" \"npm run playground:build\" \"npm run lite\""

It seems to me that lite-server starts before the gulp task has deleted the .tmp and build folders, so it starts using them and doesn't want to let them go.

I was able to work around it by modifying the script to the following:

"playground": "concurrently \"npm run build && npm run lite\" \"npm run playground:build\"",

The two build tasks will still happen concurrently, however the lite-server task will wait until npm run build is finished.

Note that this will disable auto recompilation when the library's source changes, but it will still work for the playground's source.

I'm not sure why this is an issue, as bs-config.json doesn't seem to indicate that lite-server uses .tmp or build.

minhchau2236 commented 6 years ago

Thank @UncleDave for the answer. I have tried it. It works but is not consistent. Sometimes it works, but another times the same error appears. "Error: EPERM: operation not permitted" It seems to me that this script depends on executing time.

david-on-github commented 6 years ago

I was able to get it working more consistently by setting the bs-config.json to ignore the temp and build folders and include only the dist files.

{
  "watchOptions": { 
    "ignored": [ "./tmp", "node_modules" ] 
  },
  "files": [ "!.tmp", "!/build", "./dist/**/*", "/.playground/**/*" ],
  "server": {
    "baseDir": "./src",
    "routes": {
      "/": "playground",
      "/node_modules/": "node_modules",
      "/dist/": "dist",
      "/.playground": ".playground"
    }
  }
}
minhchau2236 commented 6 years ago

Thank @david-on-github , good point.
Your solution works great at the first time run playground. Then it sticks into the same error, but this time is some sub folders in dist. It seems like windows has also prevented sacndir. "glob error { Error: EPERM: operation not permitted, scandir ...\dist.... ". It's really strange!

I'm trying to research more for better solution.

kkozlowski89 commented 6 years ago

Hello,

the same problem. I changed playground and I added everything to bs-config.json. Did you solve problem?

Thanks!

xrobert35 commented 6 years ago

Same problem here

xrobert35 commented 6 years ago

Ok, after some research, I found out (at least for me) that the problem come from the 'del' function in the gulpfile.js . Change those lines in the gulpfile may help you :

line 28 clean dist : return deleteFolders([distFolder + '/**/*.*', "!" + distFolder]);
line 174  clean:tmp : return deleteFolders([tmpFolder+ '/**/*.*']);
line 181 clean:build : return deleteFolders([buildFolder + '/**/*.*']);