Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #2883
Closed
Open
Issue created Aug 01, 2017 by Administrator@rootContributor

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

Created by: rafales

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).

Assignee
Assign to
Time tracking