Error in installing generator-liferay-theme

thumbnail
Mirto Silvio Busico, modified 5 Years ago. Regular Member Posts: 240 Join Date: 1/18/12 Recent Posts
Hi all,

I'm trying to install generator-liferay-theme for Liferay 7.0.6 GA7

Installation says I'm missing bower yo and gulpBut these modules are globally installed

Here the transcript:

sysop@vocsem:~/.npm-packages$ echo $prefix
/home/sysop/.npm-packages
sysop@vocsem:~/.npm-packages$ [b]npm install -g bower[/b]
npm WARN deprecated bower@1.8.8: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
/home/sysop/.npm-packages/bin/bower -> /home/sysop/.npm-packages/lib/node_modules/bower/bin/bower
[b]/home/sysop/.npm-packages/lib
└── bower@1.8.8[/b] 
sysop@vocsem:~/.npm-packages$ [b]npm install -g yo[/b]
loadDep:yosay → 304       ▐ ╢█████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
/home/sysop/.npm-packages/bin/yo -> /home/sysop/.npm-packages/lib/node_modules/yo/lib/cli.js
/home/sysop/.npm-packages/bin/yo-complete -> /home/sysop/.npm-packages/lib/node_modules/yo/lib/completion/index.js
> yo@3.1.0 postinstall /home/sysop/.npm-packages/lib/node_modules/yo
> yodoctor

Yeoman Doctor
Running sanity checks on your system
✔ No .bowerrc file in home directory
✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ No .yo-rc.json file in home directory
✔ Node.js version
✔ npm version
✔ yo version
Everything looks all right!
[b]/home/sysop/.npm-packages/lib
└── yo@3.1.0 [/b]
sysop@vocsem:~/.npm-packages$ [b]npm install -g gulp[/b]
/home/sysop/.npm-packages/bin/gulp -> /home/sysop/.npm-packages/lib/node_modules/gulp/bin/gulp.js
[b]/home/sysop/.npm-packages/lib
└── gulp@4.0.2[/b] 
npm WARN optional Skipping failed optional dependency /gulp/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.2.9
sysop@vocsem:~/.npm-packages$ [b]npm install -g generator-liferay-theme@7.0.6[/b]
npm WARN deprecated CSSselect@0.4.1: the module is now available as 'css-select'
npm WARN deprecated CSSwhat@0.4.7: the module is now available as 'css-what'
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN deprecated samsam@1.1.2: This package has been deprecated in favour of @sinonjs/samsam
[b]/home/sysop/.npm-packages/lib
├── UNMET PEER DEPENDENCY bower@>=1.3.0
├── generator-liferay-theme@7.0.6 
├── UNMET PEER DEPENDENCY gulp@>=3.5.0
└── UNMET PEER DEPENDENCY yo@>=1.0.0[/b]
npm WARN generator-liferay-theme@7.0.6 requires a peer of bower@>=1.3.0 but none was installed.
npm WARN generator-liferay-theme@7.0.6 requires a peer of gulp@>=3.5.0 but none was installed.
npm WARN generator-liferay-theme@7.0.6 requires a peer of yo@>=1.0.0 but none was installed.
sysop@vocsem:~/.npm-packages$ 

What I'm doing wrong?
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
I am not sure how restrictive it is, but you have bower 1.8.8 installed globally. Maybe you need to install a 1.3 version? Just guessing here. If that works, you could try the same with gulp and yo.  At least for gulp and yo the major version changed.
thumbnail
Mirto Silvio Busico, modified 5 Years ago. Regular Member Posts: 240 Join Date: 1/18/12 Recent Posts
Thanks ChristophI have a strange behaviour.
Following the step described below I was able to have a generator -liferay-theme installed without errors.But the theme generation gives an error on sass and build failsI'm using Ubuntu 18.04.3. The username is sysop and the home directory is /home/sysopI created a .npmrc file in /home/sysop containing
prefix=/home/sysop/.npm-packages
I added in /home/sysop/.profile these lines
NPM_PACKAGES=/home/sysop/.npm-packages
PATH=${PATH}:${NPM_PACKAGES}/bin
Then I installed npm distribuited with the OS
sudo apt install npm
After various attempts (I'm using a virtual machine; so I do an attempt then revert to a snapshot) I discovered that module have to be installed globally and locally.In this situation the generator -liferay-theme can be installed locally without errors (stil installing globally gives the three unmet dependencies)I worked inside a directory named /home/sysop/temiThe commands are:
cd ~/temi
npm install -g yo
npm install -g gulp
npm install -g bower
npm install -g node-gyp
npm install -g pangyp
npm install -g node-sass

npm install yo
npm install gulp
npm install bower
npm install node-gyp
npm install pangyp
npm install node-sass
npm install generator-liferay-theme@7.0.6

Now I can generate a theme; but there is a sass error. The relevant lines are:
sysop@vocsem:~/temi$ yo liferay-theme
     _-----_
    |       |    .--------------------------.
    |--(o)--|    |  Welcome to the splendid |
   `---------´   | Liferay Theme generator! |
    ( _´U`_ )    '--------------------------'
    /___A___\    
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 
? What would you like to call your theme? Base MSB
? Would you like to use this as the themeId? base-msb
? Which version of Liferay is this theme for? 7.0
? Do you need Compass support? (requires Ruby and the Sass gem to be installed) No
   create package.json
   create bower.json
   create .gitignore
   create gulpfile.js
   create src/css/custom.css
   create src/META-INF/context.xml
   create src/WEB-INF/liferay-plugin-package.properties
   create src/WEB-INF/src/resources-importer/readme.txt
   create src/WEB-INF/src/resources-importer/sitemap.json

I'm all done. Running npm install & bower install for you to install the required dependencies. If this fails, try running the command yourself.
[snip]
npm WARN prefer global pangyp@2.3.3 should be installed with -g
> node-sass@2.1.1 install /home/sysop/temi/base-msb-theme/node_modules/node-sass
> node scripts/install.js
Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.1.1/linux-x64-node-8.10/binding.node
> node-sass@2.1.1 postinstall /home/sysop/temi/base-msb-theme/node_modules/node-sass
> node scripts/build.js
module.js:549
    throw err;
    ^
Error: Cannot find module '/home/sysop/temi/base-msb-theme/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
Build failed
base-msb@0.0.0 /home/sysop/temi/base-msb-theme
├── async@0.9.2 
├─┬ c[email=mailto:check-source-formatting@1.1.10]heck-source-formatting@1.1.10 [/email]
[snip]
I'm confused: I don't know what is missing.Any hint?
thumbnail
Mirto Silvio Busico, modified 5 Years ago. Regular Member Posts: 240 Join Date: 1/18/12 Recent Posts
Well ,
I discovered that that node-sass is broken at the global level because of a missing bower
sysop@vocsem:~/temi$ npm list|grep sass
├─┬ node-sass@4.13.0
│ ├─┬ sass-graph@2.2.4
sysop@vocsem:~/temi$ npm list --global|grep sass
├─┬ node-sass@4.13.0
│ ├─┬ sass-graph@2.2.4
npm ERR! peer dep missing: bower@>=1.3.0, required by generator-liferay-theme@7.0.6
sysop@vocsem:~/temi$

So seems that generator-liferay-theme ignores local modules
Also strange is that trying to reinstall globally bower seems installing correctly but the above command (node list --global) gives a different error
sysop@vocsem:~/temi$ npm install -g bower
npm WARN deprecated bower@1.8.8: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
/home/sysop/.npm-packages/bin/bower -> /home/sysop/.npm-packages/lib/node_modules/bower/bin/bower
/home/sysop/.npm-packages/lib
└── bower@1.8.8 
sysop@vocsem:~/temi$ node list --global|grep sass
module.js:549
    throw err;
    ^
Error: Cannot find module '/home/sysop/temi/list'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
sysop@vocsem:~/temi$

Any suggestion to solve this nightmare?
Can generator-liferay-theme be forced to use local modules?

UPDATETried another clean install using only global installationgenerator-liferay-theme gives the three unmet peer dependency; but "yo liferay theme" tries (and fail) to install what it needs
Attached here a file containing the versions og the global module installed and the complete transcripf of "yo liferay-theme"
thumbnail
Mirto Silvio Busico, modified 5 Years ago. Regular Member Posts: 240 Join Date: 1/18/12 Recent Posts
Another failed attempt
Installed node from node site and not from distribution
Modules are globally installed
sysop@vocsem:~$ npm list -g --depth=0
/home/sysop/node/lib
├── bower@1.8.8
├── generator-liferay-theme@7.0.6
├── gulp@4.0.2
├── npm@6.13.0
└── yo@3.1.0

Installing or reinstalling generator-liferay-theme always gives the three missing dependencies
sysop@vocsem:~$ npm install -g generator-liferay-theme@7.0.6
npm WARN deprecated CSSselect@0.4.1: the module is now available as 'css-select'
npm WARN deprecated CSSwhat@0.4.7: the module is now available as 'css-what'
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN deprecated samsam@1.1.2: This package has been deprecated in favour of @sinonjs/samsam
npm WARN generator-liferay-theme@7.0.6 requires a peer of bower@>=1.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN generator-liferay-theme@7.0.6 requires a peer of gulp@>=3.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN generator-liferay-theme@7.0.6 requires a peer of yo@>=1.0.0 but none is installed. You must install peer dependencies yourself.
+ generator-liferay-theme@7.0.6
updated 1 package in 10.46s

Where is generator-liferay-theme looking for modules?
Attached more information in the console transcript