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

yarn create fails when specifying a package version #6587

Open
Bnaya opened this issue Oct 26, 2018 · 1 comment
Open

yarn create fails when specifying a package version #6587

Bnaya opened this issue Oct 26, 2018 · 1 comment
Assignees
Labels

Comments

@Bnaya
Copy link

Bnaya commented Oct 26, 2018

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

What is the current behavior?
Running:
yarn create react-app@next --help
fails with an error:

success Installed "create-react-app@2.0.5-next.c662dfb0" with binaries:
      - create-react-app
/bin/sh: /usr/local/bin/create-react-app@next: No such file or directory

What is the expected behavior?
should run /usr/local/bin/create-react-app and not /usr/local/bin/create-react-app@next

Please mention your node.js, yarn and operating system version.
yarn 1.10.1, mac os Mojave, node v8.11.3

Note that with npx you need to supply the version using additional flag:

npx create-react-app test-app-typescript --typescript --scripts-version=@next
@ghost ghost assigned kaylie-alexa Oct 26, 2018
@ghost ghost added the triaged label Oct 26, 2018
@edmorley
Copy link
Contributor

This is affecting us too, using yarn 1.12.3, Node.js 11.0.0, Windows 10 x64:

$ yarn create @neutrinojs/project@next foo
yarn create v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "@neutrinojs/create-project@9.0.0-beta.1" with binaries:
      - create-project
'C:\Users\Ed\AppData\Local\Yarn\bin\create-project@next' is not recognized
as an internal or external command, operable program or batch file.
error Command failed.
Exit code: 1
Command: C:\Users\Ed\AppData\Local\Yarn\bin\create-project@next
Arguments: foo
Directory: C:\Users\Ed\src
Output:

It looks like the tag would need to be handled here:

export function parsePackageName(str: string): Object {
if (str.charAt(0) === '/') {
throw new Error(`Name should not start with "/", got "${str}"`);
}
if (str.charAt(0) === '.') {
throw new Error(`Name should not start with ".", got "${str}"`);
}
const parts = str.split('/');
const isScoped = str.charAt(0) === '@';
if (isScoped && parts[0] === '@') {
throw new Error(`Scope should not be empty, got "${str}"`);
}
const scope = isScoped ? parts[0] : '';
const name = parts[isScoped ? 1 : 0] || '';
const path = parts.slice(isScoped ? 2 : 1).join('/');
const fullName = [scope, name].filter(Boolean).join('/');
const full = [scope, name, path].filter(Boolean).join('/');
return {fullName, name, scope, path, full};
}

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

3 participants