acquia / blt

Acquia's toolset for automating Drupal 8 and 9 development, testing, and deployment.
https://docs.acquia.com/blt/
GNU General Public License v2.0
442 stars 394 forks source link

DX-5172: Where to define node version for blt source:build:frontend-reqs? #4606

Closed drfuzetto closed 1 year ago

drfuzetto commented 1 year ago

I want to... I want to run blt source:build:frontend-reqs using node: '8.9.x'

It's not working because... The package-lock.json file was created with an old version of npm.

Detailed error output npm WARN old lockfile npm WARN old lockfile The package-lock.json file was created with an old version of npm, npm WARN old lockfile so supplemental metadata must be fetched from the registry. npm WARN old lockfile npm WARN old lockfile This is a one-time fix-up, please be patient... npm WARN old lockfile npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'NIDCR@0.1.0', npm WARN EBADENGINE required: { node: '8.9.x' }, npm WARN EBADENGINE current: { node: 'v16.17.0', npm: '8.19.2' } npm WARN EBADENGINE }

BLT doctor output +-----------------------+-----------------------------------------------------+ | Property | Value | +-----------------------+-----------------------------------------------------+ | %paths.%root | /var/www/html/docroot | | %paths.%site | sites/default | | %paths.%modules | sites/all/modules | | %paths.%themes | sites/all/themes | | %paths.%config-sync | /var/www/html/config/default | | %paths.%files | sites/default/files | | %paths.%temp | /tmp | | %paths.%private | /var/www/html/files-private | | admin-theme | seven | | alias-searchpaths.0 | /var/www/html/drush/sites | | base-profile | This profile does not extend a base profile. | | blt-version | 13.4.0.0 | | bootstrap | Successful | | composer-version | Composer version 2.3.7 2022-06-06 16:43:28 | | config-sync | /var/www/html/config/default | | db-driver | mysql | | db-hostname | db | | db-name | db | | db-password | db | | db-port | 3306 | | db-status | Connected | | db-username | db | | drupal-settings-file | sites/default/settings.php | | drupal-version | 9.4.5 | | drush-alias-files.0 | /var/www/html/drush/sites/example.acsf.site.yml | | drush-alias-files.1 | /var/www/html/drush/sites/example.local.site.yml | | drush-alias-files.2 | /var/www/html/drush/sites/legacy.site.yml | | drush-alias-files.3 | /var/www/html/drush/sites/nidcr-dev.site.yml | | drush-alias-files.4 | /var/www/html/drush/sites/nidcr-prod.site.yml | | drush-alias-files.5 | /var/www/html/drush/sites/nidcr-test.site.yml | | drush-alias-files.6 | /var/www/html/drush/sites/nidcr.site.yml | | drush-cache-directory | /home/deborahfuzetto/.drush/cache | | drush-conf.0 | /var/www/html/vendor/drush/drush/drush.yml | | drush-conf.1 | /var/www/html/drush/drush.yml | | drush-conf.2 | /var/www/html/docroot/sites/default/local.drush.yml | | drush-script | /var/www/html/vendor/bin/drush | | drush-temp | /tmp | | drush-version | 10.6.2 | | files | sites/default/files | | install-profile | nidcr_lightning | | modules | sites/all/modules | | php-bin | /usr/bin/php8.0 | | php-conf.1 | /etc/php/8.0/cli/php.ini | | php-os | Linux | | private | /var/www/html/files-private | | root | /var/www/html/docroot | | site | sites/default | | temp | /tmp | | theme | nidcr_bootstrap | | themes | sites/all/themes | | uri | https://nidcr.ddev.site | +-----------------------+-----------------------------------------------------+

System information Using ddev on Mac 12.1

I have been successfully able to use node: '8.9.x' until recently. How can I get BLT to use the right version of node? It should be using 8.9 as defined in the package.json. Where is it configured to use 16?

mikemadison13 commented 1 year ago

BLT doesn't actually "do" anything with Node version. This is managed by the container in which you are running BLT. So, if you're running it in Lando or Acquia Pipelines or wherever, you have to manage the version of node in the container. BLT is just going to run whatever frontend command you've defined (e.g. npm install) and that's all.

mikemadison13 commented 1 year ago

so, if your case (sorry I missed the DDev note originally) you should check the DDev docs for how to configure a specific version of node js in DDev and rebuild your containers. That should do the trick.

drfuzetto commented 1 year ago

I'm using ddev locally but when this runs on Travis, it shouldn't be running ddev so how does it know to use 16 instead of 8.9?

mikemadison13 commented 1 year ago

see https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#specifying-nodejs-versions this should be what you need

drfuzetto commented 1 year ago

I have tried that but it doesn't work because this is is for language: node_js. My language is php. Even with that set I still see npm WARN EBADENGINE current: { node: 'v16.15.1', npm: '8.11.0' }

mikemadison13 commented 1 year ago

ah, so the way i handled this back when i used travis was something like this with a before_install step:

https://github.com/mikemadison13/Drupal-GovCon-2017/blob/c25421481fa63defcfc9b88b024e17a4d386ff15/.travis.yml#L58

before_install:
  # Install proper version of node for front end tasks.
  - nvm install 8.9.2
  - nvm use 8.9.2

obviously, you would have to change versions but that should work. it did for me (like 4 years ago)

drfuzetto commented 1 year ago

That did it!! Thank you @mikemadison13 for your help.