Something went wrong while setting issue due date.
Bug in create-react-app scripts-version handling (scoped package + version)
Closed
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
- Fork create-react-app, publish package under a scope (
@org/react-scripts
) - 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:
If I pass @org/react-scripts@version
- indexOf()
will return 0
(it returns position of the first occurrence).