-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
Description
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:
const reMatch = 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:
const matchedModule = 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels