webiny / webiny-js

Open-source serverless enterprise CMS. Includes a headless CMS, page builder, form builder, and file manager. Easy to customize and expand. Deploys to AWS.
https://www.webiny.com
Other
7.39k stars 612 forks source link

npx create-webiny-project does not recognize npm version correctly #4213

Open LeoDeJaneiro opened 3 months ago

LeoDeJaneiro commented 3 months ago

Version

-

Operating System

MacOs 13.6.7 (22G720)

Browser

-

What are the steps to reproduce this bug?

Installation of NodeJs v20.11.1 via asdf

$ node --version
v20.11.1
$ which npm
/Users/.../.asdf/shims/npm
$ npm --version
10.8.2
$ npx --version
10.8.2
$ npx create-webiny-project webiny-fresh
Webiny requires npm@^10 or higher.
Please run npm install npm@latest -g, to get the latest version.

What is the expected behavior?

Should be possible to bootstrap project with NPM 10.8.2 according to printed requirement.

What do you see instead?

Webiny requires npm@^10 or higher. Please run npm install npm@latest -g, to get the latest version.

Additional information

No response

Possible solution

No response

thirdender commented 2 weeks ago

I'm having the same issue with npm 10.9.0 (with Node v20.18.0 on Ubuntu)

thirdender commented 2 weeks ago

:hammer: I found a workaround, I was able to run yarn create webiny-project headless instead.

It looks like npm --version (https://github.com/webiny/webiny-js/blob/5e0b6cbd8291624b27323a4d2ed679732c5948e4/packages/create-webiny-project/utils/getNpmVersion.js#L5C9-L5C62) returns nothing when run by execa on my system. Did something change with npm recently, or is this related to how I have npm installed on my system? Running npm --version from the command line returns the expected value.

{
  command: 'npm --version',
  stdout: '',
  stderr: '',
  stdio: [ undefined, '', '' ],
  ipcOutput: [],
  pipedFrom: []
}
Pavel910 commented 2 weeks ago

This is a very weird issue. I'm able to create projects without problems using npm 10.8.1 and node 20.16.0. This is how we detect npm version: https://github.com/webiny/webiny-js/blob/next/packages/create-webiny-project/utils/getNpmVersion.js

There really isn't anything complex about the version detection, it's just running npm --version.