简体   繁体   English

yarn add 命令不安装 package

[英]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.我有一个非常简单的节点项目,我想通过纱线 package 经理添加 dotenv package。 I'm working on linux Ubuntu 20.04.3 LTS.我正在研究 linux Ubuntu 20.04.3 LTS。 I'm typing command:我正在输入命令:

yarn add dotenv

The output is: output 是:

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: 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.我在另一个项目中使用 npm。 Is it caused by mixture of them in operating system?它是由它们在操作系统中混合引起的吗?

Looks that the NPM registry is misconfigured.看起来 NPM 注册表配置错误。 Try running this command to reset registry URL:尝试运行此命令来重置注册表 URL:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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