generator-angular2-library icon indicating copy to clipboard operation
generator-angular2-library copied to clipboard

npm run playground permission issue

Open minhchau2236 opened this issue 7 years ago • 7 comments

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?

minhchau2236 avatar Oct 30 '17 09:10 minhchau2236

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.

UncleDave avatar Jan 04 '18 12:01 UncleDave

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.

minhchau2236 avatar Jan 05 '18 02:01 minhchau2236

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"
    }
  }
}

david-on-github avatar Jan 08 '18 23:01 david-on-github

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.

minhchau2236 avatar Jan 09 '18 03:01 minhchau2236

Hello,

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

Thanks!

kkozlowski89 avatar Jan 15 '18 17:01 kkozlowski89

Same problem here

xrobert35 avatar Feb 05 '18 22:02 xrobert35

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 + '/**/*.*']);

xrobert35 avatar Feb 05 '18 22:02 xrobert35