Found when helping on the issue #697.
When trying to installing an specific version of a module, e.g. npx nuxi@latest module add content@2.13.0 an error is thrown:
ERROR Cannot read properties of undefined (reading 'dependencies')
I take a look at cli/packages/nuxi/src/commands/module/add.ts and even it have a regex validation and an assign of pkgName and pkgVersion:
constreMatch=moduleName.match(packageRegex)if(reMatch){if(reMatch[3]){pkgName=`${reMatch[1]||''}${reMatch[2]||''}`pkgVersion=reMatch[3].slice(1)}}when the command tries to find the match module on the modulesDB it keeps taking in consideration the initial moduleName, that contains the version:
constmatchedModule=modulesDB.find(module=>module.name===moduleName||module.npm===pkgName||module.aliases?.includes(pkgName),)
Yet it still possible to install a module with version if we describe the whole package name: npx nuxi@latest module add @nuxt/content@2.13.0 but it is kind of anoying when we have a Nuxt official module.
Found when helping on the issue #697.
When trying to installing an specific version of a module, e.g.
npx nuxi@latest module add content@2.13.0an error is thrown:I take a look at
cli/packages/nuxi/src/commands/module/add.tsand even it have a regex validation and an assign ofpkgNameandpkgVersion:when the command tries to find the match module on the modulesDB it keeps taking in consideration the initial
moduleName, that contains the version:Yet it still possible to install a module with version if we describe the whole package name:
npx nuxi@latest module add @nuxt/content@2.13.0but it is kind of anoying when we have a Nuxt official module.