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

Bug in create-react-app scripts-version handling (scoped package + version) #2883

Closed
rafales opened this issue Aug 1, 2017 · 1 comment
Closed

Comments

@rafales
Copy link

rafales commented Aug 1, 2017

Environment

➜  /tmp  node -v
v6.10.0
➜  /tmp  npm -v
5.0.3
➜  /tmp  yarn --version
0.27.5

OS: MacOS 10.12.5

Steps to Reproduce

  1. Fork create-react-app, publish package under a scope (@org/react-scripts)
  2. Try to specify custom scripts with a version create-react-app --scripts-version=@org/react-scripts@0.9.0-beta.0 hello

Expected Behavior

Project gets bootstrapped properly.

Actual Behavior

Error:

Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module '/private/tmp/hello/node_modules/@org/react-scripts@0.9.0-beta.0/package.json'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at checkNodeVersion (/usr/local/lib/node_modules/create-react-app/createReactApp.js:479:23)
    at getPackageName.then.then.then.packageName (/usr/local/lib/node_modules/create-react-app/createReactApp.js:288:7)
    at process._tickCallback (internal/process/next_tick.js:103:7) code: 'MODULE_NOT_FOUND' }

Cause

There is a subtle bug in here:

https://github.com/facebookincubator/create-react-app/blob/master/packages/create-react-app/createReactApp.js#L444

If I pass @org/react-scripts@version - indexOf() will return 0 (it returns position of the first occurrence).

@wileybenet
Copy link
Contributor

+1 This pull request is to fix: #2853

@Timer Timer closed this as completed in ea9427b Aug 2, 2017
JohnNilsson referenced this issue in JohnNilsson/create-react-app-typescript Aug 9, 2017
JohnNilsson referenced this issue in JohnNilsson/create-react-app-typescript Sep 9, 2017
kasperpeulen pushed a commit to kasperpeulen/create-react-app that referenced this issue Sep 24, 2017
swengorschewski referenced this issue in swengorschewski/cra-typescript-electron Oct 16, 2017
@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
LishuGupta652 pushed a commit to LishuGupta652/create-react-app-1 that referenced this issue Oct 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants