0

I want to build an SPFX, i did the following steps:-

1)Inside c: i created a folder name SPFx

2)inside node.js i have this :-

enter image description here

3)I run this command:-

yo @microsoft/sharepoint

enter image description here

enter image description here

but i got this error:-

enter image description here

Here is the logs

2001 http fetch GET 200 https://registry.npmjs.org/normalize-package-data 145ms (cache revalidated) 2002 http fetch GET 200 https://registry.npmjs.org/any-promise 150ms (cache revalidated) 2003 http fetch GET 200 https://registry.npmjs.org/detect-indent 153ms (cache revalidated) 2004 http fetch GET 200 https://registry.npmjs.org/sort-keys 155ms (cache revalidated) 2005 http fetch GET 200 https://registry.npmjs.org/p-reflect 154ms (cache revalidated) 2006 http fetch GET 200 https://registry.npmjs.org/@pnpm%2fwrite-project-manifest 536ms (cache revalidated) 2007 http fetch GET 200 https://registry.npmjs.org/read-yaml-file 614ms (cache revalidated) 2008 timing idealTree:node_modules/@pnpm/link-bins Completed in 627ms 2009 timing idealTree:node_modules/@pnpm/error Completed in 0ms 2010 silly placeDep ROOT [email protected] OK for: @pnpm/[email protected] want: ^3.2.4 2011 silly fetch manifest @nodelib/fs.stat@^2.0.2 2012 silly fetch manifest @nodelib/fs.walk@^1.2.3 2013 silly fetch manifest glob-parent@^5.1.2 2014 silly fetch manifest merge2@^1.3.0 2015 http fetch GET 200 https://registry.npmjs.org/@nodelib%2ffs.stat 268ms (cache revalidated) 2016 http fetch GET 200 https://registry.npmjs.org/@nodelib%2ffs.walk 278ms (cache revalidated) 2017 timing idealTree:node_modules/@pnpm/package-bins Completed in 281ms 2018 timing idealTree:node_modules/@pnpm/read-modules-dir Completed in 0ms 212225 info run [email protected] postinstall node_modules/es5-ext node -e "try{require('./_postinstall')}catch(e){}" || exit 0 12226 info run [email protected] postinstall node_modules/node-sass node scripts/build.js 12227 info run [email protected] postinstall { code: 0, signal: null } 12228 timing build:run:postinstall:node_modules/es5-ext Completed in 215ms 12229 info run [email protected] postinstall { code: 1, signal: null } 12230 timing reify:rollback:createSparse Completed in 23161ms 12231 timing reify:rollback:retireShallow Completed in 0ms 12232 timing command:install Completed in 160278ms 12233 verbose stack Error: command failed 12233 verbose stack at ChildProcess. (C:\Users\mohan\AppData\Roaming\nvm\v16.13.1\node_modules\npm\node_modules@npmcli\promise-spawn\index.js:64:27) 12233 verbose stack at ChildProcess.emit (node:events:390:28) 12233 verbose stack at maybeClose (node:internal/child_process:1064:16) 12233 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) 12234 verbose pkgid [email protected] 12235 verbose cwd c:\SPFX 12236 verbose Windows_NT 10.0.22631 12237 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" 12238 verbose node v16.13.1 12239 verbose npm v8.1.2 12240 error code 1 12241 error path c:\SPFX\node_modules\node-sass 12242 error command failed 12243 error command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js 12244 error Building: C:\Program Files\nodejs\node.exe c:\SPFX\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= 12245 error gyp info it worked if it ends with ok 12245 error gyp verb cli [ 12245 error gyp verb cli 'C:\Program Files\nodejs\node.exe', 12245 error gyp verb cli 'c:\SPFX\node_modules\node-gyp\bin\node-gyp.js', 12245 error gyp verb cli 'rebuild', 12245 error gyp verb cli '--verbose', 12245 error gyp verb cli '--libsass_ext=', 12245 error gyp verb cli '--libsass_cflags=', 12245 error gyp verb cli '--libsass_ldflags=', 12245 error gyp verb cli '--libsass_library=' 12245 error gyp verb cli ] 12245 error gyp info using [email protected] 12245 error gyp info using [email protected] | win32 | x64 12245 error gyp verb command rebuild [] 12245 error gyp verb command clean [] 12245 error gyp verb clean removing "build" directory 12245 error gyp verb command configure [] 12245 error gyp verb check python checking for Python executable "python2" in the PATH 12245 error gyp verb whichfailed Error: not found: python2 12245 error gyp verbwhichfailed at getNotFoundError (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:13:12) 12245 error gyp verbwhichfailed at F (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:68:19) 12245 error gyp verbwhichfailed at E (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:80:29) 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:89:16 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\isexe\index.js:42:5 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\isexe\windows.js:36:5 12245 error gyp verbwhichfailed at FSReqCallback.oncomplete (node:fs:198:21) 12245 error gyp verbwhichfailed python2 Error: not found: python2 12245 error gyp verbwhichfailed at getNotFoundError (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:13:12) 12245 error gyp verbwhichfailed at F (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:68:19) 12245 error gyp verbwhichfailed at E (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:80:29) 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:89:16 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\isexe\index.js:42:5 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\isexe\windows.js:36:5 12245 error gyp verbwhichfailed at FSReqCallback.oncomplete (node:fs:198:21) { 12245 error gyp verbwhichfailed code: 'ENOENT' 12245 error gyp verbwhichfailed } 12245 error gyp verb check python checking for Python executable "python" in the PATH 12245 error gyp verbwhichfailed Error: not found: python 12245 error gyp verbwhichfailed at getNotFoundError (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:13:12) 12245 error gyp verbwhichfailed at F (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:68:19) 12245 error gyp verbwhichfailed at E (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:80:29) 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:89:16 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\isexe\index.js:42:5 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\isexe\windows.js:36:5 12245 error gyp verbwhichfailed at FSReqCallback.oncomplete (node:fs:198:21) 12245 error gyp verbwhichfailed python Error: not found: python 12245 error gyp verbwhichfailed at getNotFoundError (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:13:12) 12245 error gyp verbwhichfailed at F (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:68:19) 12245 error gyp verbwhichfailed at E (c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:80:29) 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\node-gyp\node_modules\which\which.js:89:16 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\isexe\index.js:42:5 12245 error gyp verbwhichfailed at c:\SPFX\node_modules\isexe\windows.js:36:5 12245 error gyp verbwhichfailed at FSReqCallback.oncomplete (node:fs:198:21) { 12245 error gyp verbwhichfailed code: 'ENOENT' 12245 error gyp verb``` which failed } `` 12245 error gyp verb could not find "python". checking python launcher 12245 error gyp verb could not find "python". guessing location 12245 error gyp verb ensuring that file exists: C:\Python27\python.exe 12245 error gyp ERR! configure error 12245 error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. 12245 error gyp ERR! stack at PythonFinder.failNoPython (c:\SPFX\node_modules\node-gyp\lib\configure.js:484:19) 12245 error gyp ERR! stack at PythonFinder. (c:\SPFX\node_modules\node-gyp\lib\configure.js:509:16) 12245 error gyp ERR! stack at callback (c:\SPFX\node_modules\graceful-fs\polyfills.js:306:20) 12245 error gyp ERR! stack at FSReqCallback.oncomplete (node:fs:198:21) 12245 error gyp ERR! System Windows_NT 10.0.22631 12245 error gyp ERR! command "C:\Program Files\nodejs\node.exe" "c:\SPFX\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" 12245 error gyp ERR! cwd c:\SPFX\node_modules\node-sass 12245 error gyp ERR! node -v v16.13.1 12245 error gyp ERR! node-gyp -v v3.8.0 12245 error gyp ERR! not ok 12245 error Build failed with error code: 1 12246 verbose exit 1

then i run npm install, but i got this error:-

enter image description here

any advice?

2 Answers 2

2

Based on your screenshot information, I found this message:

Can't find Python executable "python",you can set the PYTHON env variable.

Are you using python, but you don't set python environment variables? You can refer to this article to set it up first, and then see if the problem persists.

Error: Can't Find Python Executable Python, You Can Set the PYTHON Env Variable

0

It's seems you're trying to run SPFx v1.13.0 on node v.16.13.1 - this won't work, as SPFx v1.13.0 only supports node version v12 and v14.

Please have a look at the SPFx compatibility list below.

SPFx compatibility list

Source: https://learn.microsoft.com/en-us/sharepoint/dev/spfx/compatibility

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.