sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

EPERM error on gulp serve

Open pattarika opened this issue 7 years ago • 14 comments

Expected or Desired Behavior

Able to load https://localhost:5432/workbench

Observed Behavior

U:\test_team\sharepoint\officesite>gulp serve Build target: DEBUG [15:55:03] Using gulpfile U:\test_team\sharepoint\officesite\gulpfile.js [15:55:03] Starting gulp [15:55:03] Starting 'serve'... [15:55:03] Starting subtask 'configure-sp-build-rig'... [15:55:03] Finished subtask 'configure-sp-build-rig' after 42 ms [15:55:03] Starting subtask 'spfx-serve'... [15:55:11] Starting server... Starting api server on port 8888. Registring api: /workbench Registring api: */* [15:55:14] Finished subtask 'spfx-serve' after 11 s [15:55:14] Starting subtask 'pre-copy'... [15:55:16] Finished subtask 'pre-copy' after 1.74 s [15:55:16] Starting subtask 'copy-static-assets'... [15:55:16] Starting subtask 'sass'... [15:55:16] Server started https://localhost:4321 [15:55:16] LiveReload started on port 35729 [15:55:16] Running server [15:55:16] Opening https://localhost:8888/workbench using the default OS app [15:55:16] Finished subtask 'copy-static-assets' after 181 ms Request: [::1] '/workbench' Error: EPERM: operation not permitted, symlink 'U:\test_team\sharepoint\officesite\node_modules\@microsoft\sp-webpart-workbench' -> 'U:\test_team\sharepoint\officesite\temp\workbench-packages\@microsoft_sp-webpart-workbench at Object.fs.symlinkSync (fs.js:1014:18)

Steps to Reproduce

Window 10 U:\test_team\sharepoint\officesite>node -v v8.15.0 U:\test_team\sharepoint\officesite>npm list -g --dept 0 +-- @microsoft/[email protected] +-- [email protected] +-- [email protected] +-- [email protected] +-- [email protected]

I follow everything on https://www.youtube.com/watch?v=_Pt5cnU4MpU I also tried different ports 8080, 8888, 8443 and still got the same error. Do I get the error because I connect to VPN? This is not a personal computer. Window Defender is off. I can't change the setting on Antivirus software.

Do I need to set up proxy server? I found references on

  • http://blog.arvosys.com/2017/11/27/spfx-workbench-against-real-sharepoint-api/index.html
  • https://www.npmjs.com/package/sp-rest-proxy

pattarika avatar Jan 15 '19 22:01 pattarika

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Jan 15 '19 22:01 msft-github-bot

I don't believe this has anything to do with a proxy server, or the two links you reference, or VPN.

By chance did you do everything (install the NPM tools like SPFx generator, gulp & yeoman & run gulp serve) from an administrative command prompt? Exercising my Google-fu, looks like that's the common thing others are running into. It's not SPFx specific, rather it's Windows specific with Node/NPM...

Check this thread for people having the same issue with the Angular CLI. It's a few years old, but nothing has changed to impact the desired results / root issue.

FWIW, I use NVM to get around this; NVM installs Node.js & NPM within my profile directory on MacOS / Windows and you always have admin rights on your profile. Blogged about NVM here: http://www.andrewconnell.com/blog/better-node-js-install-management-with-node-version-manager

andrewconnell avatar Jan 16 '19 13:01 andrewconnell

yes I use administrative command prompt. Let me check NVM...

pattarika avatar Jan 16 '19 14:01 pattarika

Interesting... well, unfortunately, it doesn't appear there's anything specific to the SharePoint Framework here, so if NVM doesn't address it for you, not sure what to suggest :-/

andrewconnell avatar Jan 16 '19 15:01 andrewconnell

Same result as before.
Error: EPERM: operation not permitted, symlink 'U:\test_team\sharepoint\devsite\node_modules\@microsoft\sp-webpart-workbench' -> 'U:\test_team\sharepoint\devsite\temp\workbench-packages\@microsoft_sp-webpart-workbench' at Object.fs.symlinkSync (fs.js:1014:18) at WorkbenchPage._getUrlForPackagePath (U:\test_team\sharepoint\devsite\node_modules\@microsoft\sp-webpart-workbench\lib\api\WorkbenchPage.js:166:17) at WorkbenchPage._generateWorkbenchPageContent (U:\test_team\sharepoint\devsite\node_modules\@microsoft\sp-webpart-workbench\lib\api\WorkbenchPage.js:33:39) at WorkbenchPage.handleWorkbenchRequest (U:\test_team\sharepoint\devsite\node_modules\@microsoft\sp-webpart-workbench\lib\api\WorkbenchPage.js:25:51) at Layer.handle [as handle_request] (U:\test_team\sharepoint\devsite\node_modules\express\lib\router\layer.js:95:5) at next (U:\test_team\sharepoint\devsite\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (U:\test_team\sharepoint\devsite\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (U:\test_team\sharepoint\devsite\node_modules\express\lib\router\layer.js:95:5) at U:\test_team\sharepoint\devsite\node_modules\express\lib\router\index.js:281:22 at Function.process_params (U:\test_team\sharepoint\devsite\node_modules\express\lib\router\index.js:335:12)

pattarika avatar Jan 16 '19 17:01 pattarika

Did you do the install for all the tools (global installs of SPFx, Yeoman & Gulp) with an admin command prompt?

andrewconnell avatar Jan 16 '19 18:01 andrewconnell

all are global under admin command. Try in both CMD and powershell.
npm install -g <package_name>

pattarika avatar Jan 16 '19 18:01 pattarika

Not understanding your response... to be clear, my question was

Were you using an administrative command prompt when you ran:

npm install gulp yo @microsoft/generator-sharepoint -g

If not, I'd uninstall them and try again.

Also... were you using an administrative command prompt when you (1) created the project and (2) ran npm install (or let the Yeoman generator run it)? If not, I'd try that with a new project.

If none of these things help, I'm not sure what we can do in this issue... as this isn't a SharePoint thing. This might be more of a specific issue with your environment (you say it's a work laptop... so I'm guessing it's locked down?)... I'd look to the NPM support channels, unfortunately... it's hard to reproduce as I just verified everything installs just fine using the same version of Node.js that you used on my test Windows machine. :(

andrewconnell avatar Jan 16 '19 19:01 andrewconnell

I can see https://localhost:4321/temp/workbench.html now. I have to create the directory on C: drive, and not a network drive.

pattarika avatar Jan 16 '19 22:01 pattarika

I had the same issue. After spending entire night debugging the issue it was concluded that issue definitely caused to TFS source control. If I remove the read-only flag from project folder than issue goes away but as soon I checkin any file visual studio re-enables the read-only flag on project folders.

As a workaround I added a "fix" script in package.json file that removes the readonly flag from src folder of my project. Run-s command is taken from "npm run-all" module.

Snippet from package.json: "scripts": { "serve": "gulp clean serve", "build": "gulp clean bundle", "proxy": "node ./config/proxy_sp.js", "fix": "attrib -r .\src\. /s", "start": "run-s fix proxy serve" },

hassanamjad91 avatar Sep 05 '19 14:09 hassanamjad91

It absolutely can't be a read only folder... the build process copies files into the temp folder that are used to implement the web server & local workbench. If it's read only, the copy process will fail.

andrewconnell avatar Sep 05 '19 15:09 andrewconnell

It absolutely can't be a read only folder... the build process copies files into the temp folder that are used to implement the web server & local workbench. If it's read only, the copy process will fail.

My client manage repos in TFS instead of github. Therefore my spfx solution is setup in VS 2017. Unfortunately when the project is binded with TFS Source Control all files of the project become readonly. Therefore when I run gulp serve or gulp build the build script fails when it tries to copy the manifest.json file for each webpart from src folder to lib folder. When I remove the readonly from the src folder the error goes away. Unfortunately TFS Source Control will make all project files readonly again as soon as any file is checked In. I mentioned workaround for this above.

Hey Andrew, Can you think of a more elegant solution for this?

hassanamjad91 avatar Sep 05 '19 15:09 hassanamjad91

Other than not using TFS, nope. Yet another reason why so many have moved to git repos.

Note: it's not TFS vs. github... it's TFS repos or git repos. For instance, when creating a new project in Azure DevOps, you can choose if you want to use TFS or git for the repo type.

andrewconnell avatar Sep 05 '19 16:09 andrewconnell

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 25 '20 12:01 msft-github-bot