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

SPFx Yo generator npm error using node 8.15.0

Open vikasbansal9888 opened this issue 7 years ago • 19 comments

First I installed npm install @microsoft/generator-sharepoint --save-dev on project folder level. Getting warning and error while running cmd yo @microsoft/sharepoint

npm WARN tar ENOENT: no such file or directory, lstat \node_modules.staging
npm WARN tar ENOENT: no such file or directory, open \node_modules.staging\

npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Windows\System32\hello8\node_modules.staging\typescript-45e8ba96\lib\tsc.js' npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'unlink', npm ERR! path: 'C:\Windows\System32\hello8\node_modules\.staging\typescript-45e8ba96\lib\tsc.js' }

Find below the complete log file. 2019-01-18T06_56_34_925Z-debug.log

NOTE: Commands are getting struck/not responding properly while executing.

Category

  • [ ] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Additional article idea

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

For the above list, an empty checkbox is [ ] as in [SPACE]. A checked checkbox is [x] with no space between the brackets. Use the PREVIEW tab at the top right to preview the rendering before submitting your issue.

If you are planning to share a new feature request (enhancement / suggestion), please use SP Dev UserVoice at http://aka.ms/sp-dev-uservoice. (DELETE THIS PARAGRAPH AFTER READING)

(DELETE THIS PARAGRAPH AFTER READING)

Expected or Desired Behavior

Wants to setup and SPFx development environment and create HelloWorld webpart.

If you are reporting a bug, please describe the expected behavior. If you are suggesting an enhancement please describe thoroughly the enhancement, how it can be achieved, and expected benefit.

(DELETE THIS PARAGRAPH AFTER READING)

Observed Behavior

Facing lots of issues in setting environment and creating SPFx project

If you are reporting a bug, please describe the behavior you expected to occur when performing the action. If you are making a suggestion, you can delete this section.

(DELETE THIS PARAGRAPH AFTER READING)

Steps to Reproduce

I'm referring the official MS docs site for setting up environment and creating HelloWorld webpart.

If you are reporting a bug please describe the steps to reproduce the bug in sufficient detail to allow testing. Only way to fix things properly, is to have sufficient details to reproduce it. If you are making a suggestion, you can delete this section.

(DELETE THIS PARAGRAPH AFTER READING)

Submission Guidelines

  • All suggestions or bugs are welcome, please let us know what's on your mind.
  • If you are reporting an issue around any of the documents or articles, please ensure that you have clear > reference on the specific file or URL, which should be fixed.
  • If you have technical questions about the framework, we’ll be monitoring #spfx, #spfx-webparts, and > #spfx-tooling on (SharePoint StackExchange)[http://sharepoint.stackexchange.com/]. You can also > alternatively submit your question to (SharePoint Developer group)> [https://network.office.com/t5/SharePoint-Developer/bd-p/SharePointDev] at Office Network.
  • Remember to include sufficient details and context.
  • If you have multiple suggestions or bugs please submit them in separate bugs so we can track resolution.

(DELETE THIS PARAGRAPH AFTER READING)

Thanks for your contribution! Sharing is caring.

vikasbansal9888 avatar Jan 18 '19 13:01 vikasbansal9888

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

msft-github-bot avatar Jan 18 '19 13:01 msft-github-bot

Please tag this issue with https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part for reference

vikasbansal9888 avatar Jan 18 '19 13:01 vikasbansal9888

First I installed npm install @microsoft/generator-sharepoint --save-dev on project folder level. Getting warning and error while running cmd yo @microsoft/sharepoint

You will find the complete guide on how to get started in the Overview of SharePoint Framework (SPFx) in the documentation.

You cannot add this package as a dependency to a project you need to install the yeoman generator first global.

npm install -g @microsft/generator-sharepoint

Before you can run:

yo @microsoft/sharepoint

StfBauer avatar Jan 18 '19 15:01 StfBauer

I am referring https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment.

My requirement is like below and also mentioned in the Install Yeoman SharePoint generator section. https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment#install-yeoman-sharepoint-generator Need to switch between the different projects created by using different versions of the SharePoint Framework Yeoman generator, you can install the generator locally as a development dependency in the project folder by executing the following command: npm install @microsoft/generator-sharepoint --save-dev

vikasbansal9888 avatar Jan 21 '19 06:01 vikasbansal9888

@vikasbansal9888 Thank you for pointing out this issue in the documentation. Sadly you cannot switch between different versions the way described there. You will always fall back to the globally installed generator. The only option you have is to upgrade the projects to the latest release in case you like to add something new to it. As long as you code on the same, for example, web part you can use the project without any problem.

Office 365 CLI, for example, helps you to upgrade to the latest version. https://blog.mastykarz.nl/upgrade-sharepoint-framework-project-office-365-cli/

Another option is to use a tool named NVM: http://www.andrewconnell.com/blog/better-node-js-install-management-with-node-version-manager

Or add additional assets using a tool named npx: https://n8d.at/blog/how-to-use-specific-nodejs-version-with-your-spfx-project/

All this depends highly on what you like to do.

StfBauer avatar Jan 21 '19 20:01 StfBauer

As suggested by @StfBauer , Please update the documentation as its misleading and have installed the generator globally. npm install -g @microsoft/generator-sharepoint

But still getting warning and error while running cmd yo @microsoft/sharepoint at project folder level.

Error logs. npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Official\Projects\SPFx\Hello12\node_modules.staging\office-ui-fabric-react-83dbef6a\dist\office-ui-fabric-react.js' npm ERR! cause: npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Official\Projects\SPFx\Hello12\node_modules.staging\office-ui-fabric-react-83dbef6a\dist\office-ui-fabric-react.js' npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'unlink', npm ERR! path: 'C:\Official\Projects\SPFx\Hello12\node_modules\.staging\office-ui-fabric-react-83dbef6a\dist\office-ui-fabric-react.js' }, npm ERR! stack: 'Error: EPERM: operation not permitted, unlink 'C:\Official\Projects\SPFx\Hello12\node_modules\.staging\office-ui-fabric-react-83dbef6a\dist\office-ui-fabric-react.js'', npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'unlink', npm ERR! path: 'C:\Official\Projects\SPFx\Hello12\node_modules\.staging\office-ui-fabric-react-83dbef6a\dist\office-ui-fabric-react.js', npm ERR! parent: 'hello-12' }

Find complete log file 2019-01-22T07_46_41_253Z-debug.log

vikasbansal9888 avatar Jan 22 '19 07:01 vikasbansal9888

PR for the documentation update is already out. So you have installed the generator for this project already locally. Haven't you? Can you please share your package.json file.

Alternatively, if you have still the generator in your project. You can first execute:

npm uninstall @microsoft/generator-sharepoint

Without the -g option.

StfBauer avatar Jan 22 '19 08:01 StfBauer

Firstly uninstalled generator without -g option npm uninstall @microsoft/generator-sharepoint Also, verified that the generator is present at global level npm ls -g --depth=0 +-- @microsoft/[email protected] +-- [email protected] '-- [email protected]

Then created new project folder and ran yo @microsoft/sharepoint at the folder level

Please find below the package.json file (JSON file upload not supported) { "name": "hello-14", "version": "0.0.1", "private": true, "engines": { "node": ">=0.10.0" }, "scripts": { "build": "gulp bundle", "clean": "gulp clean", "test": "gulp test" }, "dependencies": { "@microsoft/sp-core-library": "1.7.1", "@microsoft/sp-webpart-base": "1.7.1", "@microsoft/sp-lodash-subset": "1.7.1", "@microsoft/sp-office-ui-fabric-core": "1.7.1", "@types/webpack-env": "1.13.1", "@types/es6-promise": "0.0.33" }, "devDependencies": { "@microsoft/sp-build-web": "1.7.1", "@microsoft/sp-tslint-rules": "1.7.1", "@microsoft/sp-module-interfaces": "1.7.1", "@microsoft/sp-webpart-workbench": "1.7.1", "gulp": "~3.9.1", "@types/chai": "3.4.34", "@types/mocha": "2.2.38", "ajv": "~5.2.2" } }

Thanks.

vikasbansal9888 avatar Jan 22 '19 12:01 vikasbansal9888

@StfBauer please suggest next step that i need to perform.

vikasbansal9888 avatar Jan 28 '19 06:01 vikasbansal9888

@vikasbansal9888 Have you got the same issues from before or new issues?

StfBauer avatar Jan 31 '19 20:01 StfBauer

Its somewhat related issue (can be considered as new). As per your previous comment https://github.com/SharePoint/sp-dev-docs/issues/3293#issuecomment-456313961 , i have done changes and shared the package.json file https://github.com/SharePoint/sp-dev-docs/issues/3293#issuecomment-456384854

I'm facing error, no solid success achieved in creating the basic HelloWorld webpart.

vikasbansal9888 avatar Feb 01 '19 07:02 vikasbansal9888

@vikasbansal9888 Yes but the same errors or a new one?

StfBauer avatar Feb 01 '19 10:02 StfBauer

Its a new error

vikasbansal9888 avatar Feb 01 '19 10:02 vikasbansal9888

@vikasbansal9888 and what is the error?

StfBauer avatar Feb 01 '19 10:02 StfBauer

Now getting warning and error while running cmd yo @microsoft/sharepoint

{ Error: EPERM: operation not permitted, unlink 'C:\Official\Projects\SPFx\Hello14\node_modules\.staging\office-ui-fabric-react-8c9fb439\dist\office-ui-fabric-react.js.map' 27317 error errno: -4048, 27317 error code: 'EPERM', 27317 error syscall: 'unlink', 27317 error path: 'C:\\Official\\Projects\\SPFx\\Hello14\\node_modules\\.staging\\office-ui-fabric-react-8c9fb439\\dist\\office-ui-fabric-react.js.map' }

Find complete log file 2019-01-22T11_56_17_813Z-debug.log

vikasbansal9888 avatar Feb 01 '19 11:02 vikasbansal9888

EPERM errors show mostly a permission problem or when files are currently in use by your operating system. So it is more related to your base system and not obviously the generator or SPFx.

StfBauer avatar Feb 06 '19 09:02 StfBauer

image

Hi,

I am facing similar issue and at question 4 (mentioned below) it somehow gets hung.

? Do you want to allow the tenant admin the choice of being able to deploy the solution to all sites immediately without running any feature deployment or adding apps in sites? (y/N)

I have tried installing and uninstalling NODE, Yo, Gulp but no luck. Please suggest next action to resolve this.

FYI - I have followed same steps mentioned in https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment article

Thank you!!!

Divyeshkotadia avatar Jun 21 '19 02:06 Divyeshkotadia

This is a relatively old issue with no recent activity. Please install the latest version of SPFx and try again. If you have issues, please provide additional context info (installed version numbers, platform, etc).

andrewconnell avatar Nov 01 '19 17:11 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