简体   繁体   中英

yarn add command dosen't install package

I have very simple node project where I'd like to add dotenv package by yarn package manager. I'm working on linux Ubuntu 20.04.3 LTS. I'm typing command:

yarn add dotenv

The output is:

error An unexpected error occurred: "npm/dotenv: Invalid URI \"npm/dotenv\"".
info If you think this is a bug, please open a bug report with the information provided in "/home/krzysztofmichalski/projects/dotenv-learning/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Content of yarn-error.log:

Arguments: 
  /usr/local/bin/node /usr/local/bin/yarn add dotenv

PATH: 
  /home/krzysztofmichalski/anaconda3/bin:/home/krzysztofmichalski/anaconda3/condabin:/home/krzysztofmichalski/projects/cucumber-gherking-learning/node_modules/bin:vendor/bin:/home/krzysztofmichalski/.symfony/bin:/home/krzysztofmichalski/projects/apache-kafka/kafka_2.13-2.8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/krzysztofmichalski/projects/dotenv-learning/node_modules/.bin

Yarn version: 
  1.22.17

Node version: 
  17.3.0

Platform: 
  linux x64

Trace: 
  Error: npm/dotenv: Invalid URI "npm/dotenv"
      at Request.module.exports.Request.init (/usr/local/lib/node_modules/yarn/lib/cli.js:140971:31)
      at new Request (/usr/local/lib/node_modules/yarn/lib/cli.js:140825:8)
      at request (/usr/local/lib/node_modules/yarn/lib/cli.js:137731:10)
      at RequestManager.execute (/usr/local/lib/node_modules/yarn/lib/cli.js:67081:15)
      at RequestManager.shiftQueue (/usr/local/lib/node_modules/yarn/lib/cli.js:67119:10)
      at /usr/local/lib/node_modules/yarn/lib/cli.js:66788:13
      at new Promise (<anonymous>)
      at new F (/usr/local/lib/node_modules/yarn/lib/cli.js:5301:28)
      at RequestManager.request (/usr/local/lib/node_modules/yarn/lib/cli.js:66786:19)
      at NpmRegistry.<anonymous> (/usr/local/lib/node_modules/yarn/lib/cli.js:31747:42)

npm manifest: 
  {
    "name": "dotenv-learning",
    "version": "1.0.0",
    "main": "index.js",
    "license": "MIT",
    "dependencies": {
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  No lockfile

I don't know why is that. I'm using npm in another projects. Is it caused by mixture of them in operating system?

Looks that the NPM registry is misconfigured. Try running this command to reset registry URL:

yarn config set registry "https://registry.yarnpkg.com" -g

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM