richflow
richflow

Reputation: 2144

npm ERR! Invalid dependency type requested: alias

Inherited project says to run npm install to install packages for project. But when I do I get the following error:

npm ERR! Invalid dependency type requested: alias

In the log I can see the following messages:

212 silly fetchPackageMetaData error for redux-form-7@npm:[email protected] Invalid dependency type requested: alias

...

2744 verbose stack Error: Invalid dependency type requested: alias

2744 verbose stack at getFetcher (/Users/rich/.nvm/versions/node/v10.15.0/lib/node_modules/npm/node_modules/pacote/lib/fetch.js:68:15)

2744 verbose stack at manifest (/Users/rich/.nvm/versions/node/v10.15.0/lib/node_modules/npm/node_modules/pacote/lib/fetch.js:15:19)

2744 verbose stack at pinflight (/Users/rich/.nvm/versions/node/v10.15.0/lib/node_modules/npm/node_modules/pacote/manifest.js:24:12)

...

In package.json is the following:

{
  "dependencies": {
    "redux-form": "5.3.3",
    "redux-form-7": "npm:[email protected]"
  }
}

I've googled and searched SO but I can't find what this dependency syntax is meant to do or what the error means?

Upvotes: 41

Views: 60111

Answers (6)

Enrique
Enrique

Reputation: 1

For me it worked to install/use required node version (nvm use), then npm i worked fine

Upvotes: 0

Leela Krishna
Leela Krishna

Reputation: 41

The issue could be due to the node version. Pls upgrade the node version to solve the problem. This helped me to address the problem.

Upvotes: 0

Raphael Krausz
Raphael Krausz

Reputation: 321

If you are still having troubles upgrading to the latest version of npm, due to the same "ERR! Invalid dependency type requested: alias" error, then do the following:

  1. First install npm v6.9.0. As previous versions didn't have alias support, it will install fine. Thanks andrewkittredge!

    npm i -g [email protected]

  2. Then you can upgrade to the latest version of npm

    npm i -g npm@latest

Upvotes: 20

Philipp Galliker
Philipp Galliker

Reputation: 49

Under Mac OS this worked for me

  1. Delete the folder /Users/userName/.npm (this is a hidden folder, so you have to unhide hidden folders first with keyboard shortcut "Command" + "Shift" + "." if you want to delete it via the Finder)
  2. sudo npm i -g npm@latest

Upvotes: 0

richflow
richflow

Reputation: 2144

Edit: at the time of writing, this feature was not supported by npm. See Andrew's answer for which versions of npm now support it.

Original answer:

It seems this is a feature of yarn and not npm.

Using yarn to install packages worked fine with this package.json.

Upvotes: 9

andrewkittredge
andrewkittredge

Reputation: 850

npm >= 6.9.0 can handle aliases, https://npm.community/t/release-npm-6-9-0/5911.

Upvotes: 31

Related Questions