diff --git a/CHANGELOG.md b/CHANGELOG.md index 8636a43..dd8dcb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) * Updated Node support to include the latest minor versions for Node `23` (up to `23.8`), `22` (up to `22.14`), `20` (up to `20.18`), `19` (up to `19.9`), `18` (up to `18.20`), and `16` (up to `16.20`) +* Fixed issue causing npx scripts to fail ([#97](https://github.com/lando/node/issues/97)) ## v1.4.0 - [December 20, 2024](https://github.com/lando/node/releases/tag/v1.4.0) diff --git a/builders/node.js b/builders/node.js index d0fbb57..0ce200f 100644 --- a/builders/node.js +++ b/builders/node.js @@ -4,6 +4,7 @@ const _ = require('lodash'); // Constants +const LEGACY_DEFAULT_VERSION = '14'; const supportedVersions = [ '23', '23.8', @@ -220,7 +221,7 @@ const pkger = (pkg, version = 'latest') => `${pkg}@${version}`; module.exports = { name: 'node', config: { - version: '14', + version: LEGACY_DEFAULT_VERSION, supported: supportedVersions, patchesSupported: true, legacy: ['12', '10', '8', '6'], @@ -270,10 +271,11 @@ module.exports = { // Add port to "moreHttpsPorts" options.moreHttpPorts.push(options.port); // Add our npm things to run step + let commands = ['mkdir -p $NPM_CONFIG_PREFIX/{bin,lib,share}']; if (!_.isEmpty(options.globals)) { - const commands = require('../utils/get-install-commands')(options.globals, pkger, ['npm', 'install', '-g']); - require('../utils/add-build-step')(commands, options._app, options.name); + commands = require('../utils/get-install-commands')(options.globals, pkger, ['npm', 'install', '-g']); } + require('../utils/add-build-step')(commands, options._app, options.name); // Set the sport and moreHttpPorts if ssl is numeric if (options.ssl) { options.sport = _.isInteger(options.ssl) ? options.ssl : 443; diff --git a/examples/20/.lando.yml b/examples/20/.lando.yml index 6e52708..cd9c648 100644 --- a/examples/20/.lando.yml +++ b/examples/20/.lando.yml @@ -30,6 +30,8 @@ services: tooling: grunt: service: compass + npx: + service: cli # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/20/README.md b/examples/20/README.md index 92f7d12..b0b4be3 100644 --- a/examples/20/README.md +++ b/examples/20/README.md @@ -68,6 +68,9 @@ lando exec custom -- "which gulp | grep /var/www/.npm-global" # Should not serve port for cli lando exec cli -- "curl http://localhost" || echo $? | grep 7 +# Should execute npx scripts +lando npx cowsay "Hello World" + # Should install gruntcli lando grunt -V ``` diff --git a/examples/21/.lando.yml b/examples/21/.lando.yml index f69383f..4fbd66e 100644 --- a/examples/21/.lando.yml +++ b/examples/21/.lando.yml @@ -30,6 +30,8 @@ services: tooling: grunt: service: compass + npx: + service: cli # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/21/README.md b/examples/21/README.md index c881fed..61e2114 100644 --- a/examples/21/README.md +++ b/examples/21/README.md @@ -70,6 +70,9 @@ lando exec cli -- "curl http://localhost" || echo $? | grep 7 # Should install gruntcli lando grunt -V + +# Should execute npx scripts +lando npx cowsay "Hello World" ``` ## Destroy tests diff --git a/examples/22/.lando.yml b/examples/22/.lando.yml index e890ff7..fe579ad 100644 --- a/examples/22/.lando.yml +++ b/examples/22/.lando.yml @@ -30,6 +30,8 @@ services: tooling: grunt: service: compass + npx: + service: cli # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/22/README.md b/examples/22/README.md index 3f51039..139abad 100644 --- a/examples/22/README.md +++ b/examples/22/README.md @@ -70,6 +70,9 @@ lando exec cli -- "curl http://localhost" || echo $? | grep 7 # Should install gruntcli lando grunt -V + +# Should execute npx scripts +lando npx cowsay "Hello World" ``` ## Destroy tests diff --git a/examples/23/.lando.yml b/examples/23/.lando.yml index bd1edc0..f7bd7d4 100644 --- a/examples/23/.lando.yml +++ b/examples/23/.lando.yml @@ -30,6 +30,8 @@ services: tooling: grunt: service: compass + npx: + service: cli # This is important because it lets lando know to test against the plugin in this repo # DO NOT REMOVE THIS! diff --git a/examples/23/README.md b/examples/23/README.md index c0a1ee4..5f41fcf 100644 --- a/examples/23/README.md +++ b/examples/23/README.md @@ -70,6 +70,9 @@ lando exec cli -- "curl http://localhost" || echo $? | grep 7 # Should install gruntcli lando grunt -V + +# Should execute npx scripts +lando npx cowsay "Hello World" ``` ## Destroy tests