SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.24k stars 1.01k forks source link

Installing @microsoft/generator-sharepoint does not work #7319

Closed web265p3 closed 3 years ago

web265p3 commented 3 years ago

I just wanted to get started with SharePoint SPfx, but already setting up the development environment is problematic. I installed the LTS version of Node (14) and succeded in installing:

npm install gulp --global

and

npm install yo --global

But installing the SharePoint generator does not work:

npm install @microsoft/generator-sharepoint --global

I already tried different Node versions (latest version, 12 etc.) and restarted my computer several times. The error still apears.

The error messages I receive are:

npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN deprecated uuid@3.1.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@2.0.3: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. npm ERR! code 1 npm ERR! path C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\node-sass npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= npm ERR! gyp info it worked if it ends with ok npm ERR! gyp verb cli [ npm ERR! gyp verb cli 'C:\Program Files\nodejs\node.exe', npm ERR! gyp verb cli 'C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\node-gyp\bin\node-gyp.js', npm ERR! gyp verb cli 'rebuild', npm ERR! gyp verb cli '--verbose', npm ERR! gyp verb cli '--libsass_ext=', npm ERR! gyp verb cli '--libsass_cflags=', npm ERR! gyp verb cli '--libsass_ldflags=', npm ERR! gyp verb cli '--libsass_library=' npm ERR! gyp verb cli ] npm ERR! gyp info using node-gyp@3.8.0 npm ERR! gyp info using node@14.17.6 | win32 | x64 npm ERR! gyp verb command rebuild [] npm ERR! gyp verb command clean [] npm ERR! gyp verb clean removing "build" directory npm ERR! gyp verb command configure [] npm ERR! gyp verb check python checking for Python executable "python2" in the PATH npm ERR! gyp verb which failed Error: not found: python2 npm ERR! gyp verb which failed at getNotFoundError (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:13:12) npm ERR! gyp verb which failed at F (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:68:19) npm ERR! gyp verb which failed at E (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:80:29) npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:89:16 npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\isexe\index.js:42:5 npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\isexe\windows.js:36:5 npm ERR! gyp verb which failed at FSReqCallback.oncomplete (fs.js:192:21) npm ERR! gyp verb which failed python2 Error: not found: python2 npm ERR! gyp verb which failed at getNotFoundError (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:13:12) npm ERR! gyp verb which failed at F (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:68:19) npm ERR! gyp verb which failed at E (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:80:29) npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:89:16 npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\isexe\index.js:42:5 npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\isexe\windows.js:36:5 npm ERR! gyp verb which failed at FSReqCallback.oncomplete (fs.js:192:21) { npm ERR! gyp verb which failed code: 'ENOENT' npm ERR! gyp verb which failed } npm ERR! gyp verb check python checking for Python executable "python" in the PATH npm ERR! gyp verb which failed Error: not found: python npm ERR! gyp verb which failed at getNotFoundError (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:13:12) npm ERR! gyp verb which failed at F (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:68:19) npm ERR! gyp verb which failed at E (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:80:29) npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:89:16 npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\isexe\index.js:42:5 npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\isexe\windows.js:36:5 npm ERR! gyp verb which failed at FSReqCallback.oncomplete (fs.js:192:21) npm ERR! gyp verb which failed python Error: not found: python npm ERR! gyp verb which failed at getNotFoundError (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:13:12) npm ERR! gyp verb which failed at F (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:68:19) npm ERR! gyp verb which failed at E (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:80:29) npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\which\which.js:89:16 npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\isexe\index.js:42:5 npm ERR! gyp verb which failed at C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\isexe\windows.js:36:5 npm ERR! gyp verb which failed at FSReqCallback.oncomplete (fs.js:192:21) { npm ERR! gyp verb which failed code: 'ENOENT' npm ERR! gyp verb which failed } npm ERR! gyp verb could not find "python". checking python launcher npm ERR! gyp verb could not find "python". guessing location npm ERR! gyp verb ensuring that file exists: C:\Python27\python.exe npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. npm ERR! gyp ERR! stack at PythonFinder.failNoPython (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\node-gyp\lib\configure.js:484:19) npm ERR! gyp ERR! stack at PythonFinder. (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\node-gyp\lib\configure.js:509:16) npm ERR! gyp ERR! stack at callback (C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\graceful-fs\polyfills.js:295:20) npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (fs.js:192:21) npm ERR! gyp ERR! System Windows_NT 10.0.18363 npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" npm ERR! gyp ERR! cwd C:\Users\elsner\AppData\Roaming\npm\node_modules\@microsoft\generator-sharepoint\node_modules\node-sass npm ERR! gyp ERR! node -v v14.17.6 npm ERR! gyp ERR! node-gyp -v v3.8.0 npm ERR! gyp ERR! not ok npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\elsner\AppData\Local\npm-cache_logs\2021-09-13T09_03_47_744Z-debug.log


Document Details

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

ghost commented 3 years ago

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

bcameron1231 commented 3 years ago

Hi, can you run npm list -g --depth=0 and let us know the outputs.

web265p3 commented 3 years ago

Of course - but the node_modules folder does not exist at this point at all...

+-- @angular/cli@11.0.3 +-- @compodoc/compodoc@1.1.11 +-- @pnp/office365-cli@2.11.0 +-- generator-teams@3.0.3 +-- gulp-cli@2.3.0 +-- gulp@4.0.2 +-- npm@7.23.0 +-- rxjs-tslint@0.1.8 +-- sass@1.32.8 +-- typedoc@0.17.8 `-- yo@4.3.0

bcameron1231 commented 3 years ago

Can you install the windows-build-tools? I really don't know the issue here, could be environment specific because I can't reproduce... but it looks like there may be an issue with the installation of Node, and a dependency on Python that wasn't installed properly.

If you run npm install --global --production windows-build-too as Administrator it will install Python and create an environment variable for it as well. Then try to to re-instantiate a new SPFx project.

patmill commented 3 years ago

Ingeneral, this level of errors normally means that you have a custom .npmrc file that is forcing versions / overriding / using an upstream proxy / cache, etc. Can you start with a clean .npmrc file and go from there?

web265p3 commented 3 years ago

@patmill My global npmc file is empty. It only contains:

msvs_version=2017

web265p3 commented 3 years ago

@bcameron1231 I think that windows build tools are included already in the version of node I am using (14 LTS)? Like stated here: https://github.com/felixrieseberg/windows-build-tools

web265p3 commented 3 years ago

Guys - re installing node and restarting my computer finally solved the issue for me! Thanks a lot for helping out.

No idea why it was not working in the first place...

patmill commented 3 years ago

That's great to hear, because I was pretty stumped on how to proceed. :)

ghost commented 3 years ago

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