-1

npm init vue@latest failed

Installing create-vue@latest led to the error output:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'create-vue@3.2.2',
npm WARN EBADENGINE   required: { node: '^14.16.0 || >=16.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.12', npm: '7.5.2' }
npm WARN EBADENGINE }
/home/rsc/.npm/_npx/2f7e7bff16d1c534/node_modules/create-vue/outfile.cjs:5667
  const isFeatureFlagsUsed = typeof (argv.default ?? argv.ts ?? argv.jsx ?? argv.router ?? argv.pinia ?? argv.tests ?? argv.vitest ?? argv.cypress ?? argv.eslint) === "boolean";
                                                   ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47
npm ERR! code 1
npm ERR! path /home/rsc/share/vue-workspace
npm ERR! command failed
npm ERR! command sh -c create-vue

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/rsc/.npm/_logs/2022-07-11T06_06_23_353Z-debug.log

I am running npm on Debian 11. I have installed it by apt-get install npm. dpkg -l tells npm is of version 7.5.2+ds-2.

As I am very new to vue.js - just passed the tutorial - what to do next? My goal is to create client forms for accessing REST services.

ngong
  • 754
  • 1
  • 8
  • 23
  • 1
    Did you read the messages in the output? They're a pretty good hint as to why there's a syntax problem. – jonrsharpe Jul 11 '22 at 06:39
  • @jonrsharpe The syntax error seems to be inside library code, not OPs own code – mousetail Jul 11 '22 at 06:53
  • @mousetail yes I can see that, it's in the create-vue package, but that's not relevant to the point. – jonrsharpe Jul 11 '22 at 06:55
  • The issue is that your node version is too old. – mousetail Jul 11 '22 at 06:58
  • thanks for the comments - sure, obviously the version is not the newest. As a newcomer I wonder whether the version of npm and node.js drawn by Debian/stable is usable at all. Even if Debian is not providing the newest version, I expected it to be usable. – ngong Jul 11 '22 at 16:47

1 Answers1

3
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'create-vue@3.2.2',
npm WARN EBADENGINE   required: { node: '^14.16.0 || >=16.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.12', npm: '7.5.2' }
npm WARN EBADENGINE }

NPM warns you to update your node version, v14 LTS is fine but v16.x.x is ok too.
If you need the v12 for something else I suggest you to look into NVM for managing multiple Node versions.

Nicola Spadari
  • 549
  • 3
  • 10
  • thanks - I realized the version trouble. However, what is the root cause? Is the Debian committer lazy in maintaining versions? Or: how can I go on but still relying on the version chosen by stable Debian? E.g. can I change "latest" by something else? Or: Is Vue that new that you have to go for the latest version? – ngong Jul 11 '22 at 07:52
  • I'm not familiar with the debian environment but someone wrote more about it here https://stackoverflow.com/questions/34594314/why-do-i-get-old-versions-of-nodejs-and-npm-when-installing-with-apt-get – Nicola Spadari Jul 11 '22 at 07:57
  • 1
    thanks, Nicola - you've put me on the right track. Actually [this](https://www.geeksforgeeks.org/how-to-update-npm/) gave a step-by-step advice. Still sad, that I got no hint to stick with the Debian maintainers choice. That's gone now. – ngong Jul 11 '22 at 09:20