Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create property '_registry' on string 'yarn' #5992

Open
mcrowder65 opened this issue Jun 14, 2018 · 7 comments
Open

Cannot create property '_registry' on string 'yarn' #5992

mcrowder65 opened this issue Jun 14, 2018 · 7 comments
Assignees
Labels

Comments

@mcrowder65
Copy link

Do you want to request a feature or report a bug?

Report a bug
What is the current behavior?
I installed yarn like so: npm install -g yarn
Whenever I do anything with yarn, it gives me back: error An unexpected error occurred: "Cannot create property '_registry' on string 'yarn'".

If the current behavior is a bug, please provide the steps to reproduce.

Doing anything with yarn.

typing just yarn, yarn init, etc.

What is the expected behavior?
That yarn will work.
Please mention your node.js, yarn and operating system version.
Node.js - 8.9.4
yarn - 1.7.0 (doing yarn -v actually works)
Operating System Version: macOS High Sierra Version 10.13.4

Here is my yarn-error.log file.

Arguments:
  /Users/m0c018p/.nvm/versions/node/v8.9.4/bin/node /Users/m0c018p/.nvm/versions/node/v8.9.4/bin/yarn init -y

PATH:
  /Users/m0c018p/.nvm/versions/node/v8.9.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Yarn version:
  1.7.0

Node version:
  8.9.4

Platform:
  darwin x64

Trace:
  TypeError: Cannot create property '_registry' on string 'yarn'
      at Config.<anonymous> (/Users/m0c018p/.nvm/versions/node/v8.9.4/lib/node_modules/yarn/lib/cli.js:40252:24)
      at Generator.next (<anonymous>)
      at step (/Users/m0c018p/.nvm/versions/node/v8.9.4/lib/node_modules/yarn/lib/cli.js:98:30)
      at /Users/m0c018p/.nvm/versions/node/v8.9.4/lib/node_modules/yarn/lib/cli.js:109:13
      at <anonymous>

npm manifest:
  No manifest

yarn manifest:
  No manifest

Lockfile:
  No lockfile
@ghost ghost assigned kaylie-alexa Jun 14, 2018
@ghost ghost added the triaged label Jun 14, 2018
@mcrowder65
Copy link
Author

This seems to be a duplicate of #4618, but their issue hasn't been resolved yet :\

@kaylie-alexa
Copy link
Member

hi @mcrowder65 installation of yarn via npm is generally not recommended, would you be able to uninstall it and reinstall using one of the approaches here? https://yarnpkg.com/en/docs/install#mac-stable

@mcrowder65
Copy link
Author

Thank you for the response @kaylieEB, I followed the instructions that you gave, I ensured that yarn was not installed my system by doing npm uninstall -g yarn, and then ran brew install yarn --without-node, and I am still getting.

yarn install v1.7.0
error An unexpected error occurred: "Cannot create property '_registry' on string 'yarn'".
info If you think this is a bug, please open a bug report with the information provided in "/Users/m0c018p/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Here is my yarn-error.log

Arguments:
  /Users/m0c018p/.nvm/versions/node/v8.9.4/bin/node /usr/local/Cellar/yarn/1.7.0/libexec/bin/yarn.js

PATH:
  /Users/m0c018p/.nvm/versions/node/v8.9.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Yarn version:
  1.7.0

Node version:
  8.9.4

Platform:
  darwin x64

Trace:
  TypeError: Cannot create property '_registry' on string 'yarn'
      at Config.<anonymous> (/usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:40252:24)
      at Generator.next (<anonymous>)
      at step (/usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:98:30)
      at /usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:109:13
      at <anonymous>

npm manifest:
  "yarn"

yarn manifest:
  No manifest

Lockfile:
  No lockfile

@kaylie-alexa
Copy link
Member

Did some more digging, it looks like it could be a corrupted configuration file like in this issue #3049. Can you check with npm config list or yarn config list (or .npmrc / .yarnrrc) and delete any key that contains _registry if it exists?

@mcrowder65
Copy link
Author

Thank you for the response!

Unfortunately, I have a .npmrc file and it contains a registry line, I have tried installing yarn with and without the .npmrc file, and both times I still get the same error..

Arguments:
  /Users/m0c018p/.nvm/versions/node/v8.9.4/bin/node /usr/local/Cellar/yarn/1.7.0/libexec/bin/yarn.js init -y

PATH:
  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/m0c018p/.nvm/versions/node/v8.9.4/bin

Yarn version:
  1.7.0

Node version:
  8.9.4

Platform:
  darwin x64

Trace:
  TypeError: Cannot create property '_registry' on string 'yarn'
      at Config.<anonymous> (/usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:40252:24)
      at Generator.next (<anonymous>)
      at step (/usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:98:30)
      at /usr/local/Cellar/yarn/1.7.0/libexec/lib/cli.js:109:13
      at <anonymous>

npm manifest:
  No manifest

yarn manifest:
  No manifest

Lockfile:
  No lockfile

@dsandor
Copy link

dsandor commented Jul 26, 2019

I just ran across this issue and noticed the problem was actually a corrupt package.json file several directories above the project directory I was using yarn in. Since yarn walks up the tree and locates all the package.json files in your tree.. any bad one above your project will throw this issues.

In my situation it was because a process was bumping the version in the package.json and writing a malformed package.json back to a folder one parent above.

@FrederickEngelhardt
Copy link

This issue is similar to my #8469 resolved my issue by removing the .yarnrc file which had a lastUpdated value within it that was preventing yarn install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants