As per Sitecore document After successful installation of npm i -g @sitecore/sxa-cli
, followed the below three steps to add a theme using SXA CLI
:
Download the Sitecore theme boilerplate.
Go to
Website\App_Config\Include\z.Feature.Overrides
and enable thez.SPE.Sync.Enabler.Gulp.config.disabled
file.Switch to the downloaded theme boilerplate folder.
Getting below error when I run sxa init
PS D:\ResourceFiles\SXABoilerplate\package> sxa init
sxa : The term 'sxa' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
sxa init
+ CategoryInfo : ObjectNotFound: (sxa:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
**Update 1**
Performed all the steps suggested by @Sreekrishnan.
When run the install command "npm install -g @sitecore/sxa-cli" after uninstall, getting below error:
*D:\projects\Project name\node_modules\@sitecore\sxa-theme>npm i -g @sitecore/sxa-cli
npm ERR! Unexpected token < in JSON at position 1 while parsing near '
npm ERR! <!doctype html>
npm ERR! <htm...'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\2087200-admin\AppData\Roaming\npm-cache\_logs\2024-05-07T11_36_44_733Z-debug.log*
Checked on "Log Files", it seems like it is looking for "json file" but it is getting HTML file. Here is Log file code:
*info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'i',
1 verbose cli '-g',
1 verbose cli '@sitecore/sxa-cli'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 8543f0c507bfcfea
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://www.npmjs.com/package/@sitecore/sxa-cli 1134ms (from cache)
8 silly fetchPackageMetaData error for @sitecore/sxa-cli@latest Unexpected token < in JSON at position 1 while parsing near '
8 silly fetchPackageMetaData <!doctype html>
8 silly fetchPackageMetaData <htm...'
9 timing stage:rollbackFailedOptional Completed in 2ms
10 timing stage:runTopLevelLifecycles Completed in 1181ms
11 verbose stack SyntaxError: Unexpected token < in JSON at position 1 while parsing near '
11 verbose stack <!doctype html>
11 verbose stack <htm...'*