Create-react-app: Failing on installing react-scripts

Created on 19 May 2017  ·  21Comments  ·  Source: facebook/create-react-app

If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.

Can you reproduce the problem with latest npm?

Many errors, especially related to "missing modules", are due to npm bugs.

If you're using Windows, follow these instructions to update npm.

If you're using OS X or Linux, run this to update npm:

npm install -g npm@latest

cd your_project_directory
rm -rf node_modules
npm install

Then try to reproduce the issue again.

Can you still reproduce it?

Description

What are you reporting?
When I create a project with create-react-app, it has failing on installing react-scripts package.
I am not sure this is create-react-app issue or yarnpkg issue because when I tried to install react-scripts with yarnpkg separately, it has same issue. However, current create-react-app depends on the yarnpkg which has issue, I think it should be addressed.

Expected behavior

It should create a project without aborting, or if it is aborted, it should not delete the folder. Since it deletes the folder, the yarn-error.log file is gone.

Actual behavior

Got this message.

 mshin@1s5cj12-l  ~/Workspace/github  create-react-app test-app
Creating a new React app in /Users/mshin/Workspace/github/test-app.

Installing packages. This might take a couple minutes.
Installing react, react-dom, and react-scripts...

yarn add v0.24.5
info No lockfile found.
[1/4] 🔍  Resolving packages...
error An unexpected error occurred: "https://registry.npmjs.org/@timer%2fdetect-port: Could not authenticate npm".
info If you think this is a bug, please open a bug report with the information provided in "/Users/mshin/Workspace/github/test-app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting generated file... yarn-error.log
Deleting test-app / from /Users/mshin/Workspace/github
Done.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected):
  2. node -v: v6.9.5
  3. npm -v: 3.10.10

Then, specify:

  1. Operating system: Mac OS Sierra 10.12.5
  2. Browser and version: N/A

Reproducible Demo

mshin@1s5cj12-l  ~/Workspace/github  create-react-app test-app
Creating a new React app in /Users/mshin/Workspace/github/test-app.

Installing packages. This might take a couple minutes.
Installing react, react-dom, and react-scripts...

yarn add v0.24.5
info No lockfile found.
[1/4] 🔍  Resolving packages...
error An unexpected error occurred: "https://registry.npmjs.org/@timer%2fdetect-port: Could not authenticate npm".
info If you think this is a bug, please open a bug report with the information provided in "/Users/mshin/Workspace/github/test-app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting generated file... yarn-error.log
Deleting test-app / from /Users/mshin/Workspace/github
Done.

Most helpful comment

Can you try running yarn logout and npm logout? Then try to setup an app again.

All 21 comments

Looks like a Yarn bug. Can you try uninstalling Yarn and trying again?

We should add some way to fall back to npm on errors in Yarn but we don't have that code yet.

@gaearon yes, I have done that. I have uninstalled my current yarn and installed again. I did that via homebrew.

This is the yarn-error.log file when I tried separately.

Arguments: 
  /Users/mshin/.nvm/versions/node/v6.9.5/bin/node /usr/local/bin/yarnpkg add --exact react-scripts

PATH: 
  /Users/mshin/.nvm/versions/node/v6.9.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Yarn version: 
  0.24.5

Node version: 
  6.9.5

Platform: 
  darwin x64

npm manifest: 
  {
    "dependencies": {
      "react": "15.5.4",
      "react-dom": "15.5.4"
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
  # yarn lockfile v1


  asap@~2.0.3:
    version "2.0.5"
    resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"

  core-js@^1.0.0:
    version "1.2.7"
    resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"

  encoding@^0.1.11:
    version "0.1.12"
    resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
    dependencies:
      iconv-lite "~0.4.13"

  fbjs@^0.8.9:
    version "0.8.12"
    resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
    dependencies:
      core-js "^1.0.0"
      isomorphic-fetch "^2.1.1"
      loose-envify "^1.0.0"
      object-assign "^4.1.0"
      promise "^7.1.1"
      setimmediate "^1.0.5"
      ua-parser-js "^0.7.9"

  iconv-lite@~0.4.13:
    version "0.4.17"
    resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"

  is-stream@^1.0.1:
    version "1.1.0"
    resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"

  isomorphic-fetch@^2.1.1:
    version "2.2.1"
    resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
    dependencies:
      node-fetch "^1.0.1"
      whatwg-fetch ">=0.10.0"

  js-tokens@^3.0.0:
    version "3.0.1"
    resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"

  loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
    version "1.3.1"
    resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
    dependencies:
      js-tokens "^3.0.0"

  node-fetch@^1.0.1:
    version "1.6.3"
    resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04"
    dependencies:
      encoding "^0.1.11"
      is-stream "^1.0.1"

  object-assign@^4.1.0:
    version "4.1.1"
    resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"

  promise@^7.1.1:
    version "7.1.1"
    resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
    dependencies:
      asap "~2.0.3"

  prop-types@^15.5.7, prop-types@~15.5.7:
    version "15.5.10"
    resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
    dependencies:
      fbjs "^0.8.9"
      loose-envify "^1.3.1"

  [email protected]:
    version "15.5.4"
    resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.5.4.tgz#ba0c28786fd52ed7e4f2135fe0288d462aef93da"
    dependencies:
      fbjs "^0.8.9"
      loose-envify "^1.1.0"
      object-assign "^4.1.0"
      prop-types "~15.5.7"

  [email protected]:
    version "15.5.4"
    resolved "https://registry.yarnpkg.com/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047"
    dependencies:
      fbjs "^0.8.9"
      loose-envify "^1.1.0"
      object-assign "^4.1.0"
      prop-types "^15.5.7"

  setimmediate@^1.0.5:
    version "1.0.5"
    resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"

  ua-parser-js@^0.7.9:
    version "0.7.12"
    resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"

  whatwg-fetch@>=0.10.0:
    version "2.0.3"
    resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"

Trace: 
  Error: https://registry.npmjs.org/@timer%2fdetect-port: Could not authenticate npm
      at Request.params.callback [as _callback] (/usr/local/Cellar/yarn/0.24.5/libexec/lib/yarn-cli.js:56242:18)
      at Request.self.callback (/usr/local/Cellar/yarn/0.24.5/libexec/lib/yarn-cli.js:107837:22)
      at emitTwo (events.js:106:13)
      at Request.emit (events.js:191:7)
      at Request.<anonymous> (/usr/local/Cellar/yarn/0.24.5/libexec/lib/yarn-cli.js:108820:10)
      at emitOne (events.js:96:13)
      at Request.emit (events.js:188:7)
      at IncomingMessage.<anonymous> (/usr/local/Cellar/yarn/0.24.5/libexec/lib/yarn-cli.js:108740:12)
      at IncomingMessage.g (events.js:291:16)
      at emitNone (events.js:91:20)
      at IncomingMessage.emit (events.js:185:7)

Can you try running yarn logout and npm logout? Then try to setup an app again.

@Timer same. I logged out, and tried. But it has same issue.

I'm closing because there's nothing actionable for us here. The problem is with the npm registry you are using (either a private registry or an unofficial mirror). Please make sure your npm registry supports scoped packages, or use the official npm registry.

im getting this issue as well..

info No lockfile found.
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@timer%2fdetect-port: Could not authenticate wmira".
info If you think this is a bug, please open a bug report with the information provided in "/home/miranext/dev/nemprice/nemprice-client/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

$ create-react-app --version
1.3.1

@wmira Your npm registry proxy (or custom registry) doesn’t support scoped packages. Please either use the official npm registry or update your registry proxy.

sorry I dont have a proxy

$ npm config ls
; cli configs
scope = ""
user-agent = "npm/4.2.0 node/v7.9.0 linux x64"

; userconfig /home/miranext/.npmrc
email = "[email protected]"
progress = false

; node bin location = /home/miranext/.nvm/versions/node/v7.9.0/bin/node
; cwd = /home/miranext
; HOME = /home/miranext
; "npm config ls -l" to show all defaults.

btw I tried using angular cli which uses scoped packages from npm and worked fine. I was wondering what has changed given that I was able to use react-create-app properly on previous versions.

Since you're installing through Yarn, perhaps it's Yarn specifically that uses an incompatible proxy?

I actually not using yarn specifically and I thought create-react-app uses it by default so I dont touch any of its settings

$ yarn config list
yarn config v0.24.4
info yarn config
{ 'version-tag-prefix': 'v',
'version-git-tag': true,
'version-git-sign': false,
'version-git-message': 'v%s',
'init-version': '1.0.0',
'init-license': 'MIT',
'save-prefix': '^',
'ignore-scripts': false,
'ignore-optional': false,
registry: 'https://registry.yarnpkg.com',
'strict-ssl': true,
'user-agent': 'yarn/0.24.4 npm/? node/v7.9.0 linux x64',
lastUpdateCheck: 1495721900837 }
info npm config
{ _auth: 'd21pcmE6MmFtcjAwdDk5',
email: '[email protected]',
progress: false }
Done in 0.03s.

_auth in your .npmrc is causing the issue for Yarn.
See https://github.com/yarnpkg/yarn/issues/1952.

@gaearon thanks -- yeah I moved to create-react-app 0.6.0 version and works fine

You can uninstall Yarn in the meantime to get CRA to use npm.

I wonder if we should have this on known the know issue list or something as it looks like a yarn bug

I was having the same issue and can confirm that deleting the ~/.npmrc file (notice it's in my user home folder) fixes it allowing to use CRA from scratch. No need to uninstall yarn and so on.

@cdelaorden removing _auth only should work as well

I wonder if we should have this on known the know issue list or something as it looks like a yarn bug

It is a Yarn bug, I linked to it earlier: https://github.com/yarnpkg/yarn/issues/1952.
Yarn team is aware of this and will look into it.

We're no longer using scoped packages in 1.0.8. (at least not intentionally)
https://github.com/facebookincubator/create-react-app/releases/tag/v1.0.8

I got the same issue yesterday.

Linux 4.13.0-32-generic
node v9.2.0
npm  v5.6.0
error path /mnt/storage/all/work/test-react-new/node_modules/detect-port-alt/bin/detect-port

NPM registry is default, I'm not logged in. NPM version is the latest.
I have no idea what's wrong.

2018-02-10T08_56_16_339Z-debug.log

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jnachtigall picture jnachtigall  ·  3Comments

stopachka picture stopachka  ·  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  ·  3Comments

alleroux picture alleroux  ·  3Comments

dualcnhq picture dualcnhq  ·  3Comments