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

Running npm init inside a folder with a space doesn't work as expected #72

Open
cinderblock opened this issue Aug 4, 2017 · 6 comments

Comments

@cinderblock
Copy link

cinderblock commented Aug 4, 2017

I like storing projects in folders with spaces in the name. I know this is not compatible with npm's project naming conventions but I still feel like this should not prevent npm init from working at all.

As it stands, if you run npm init inside a folder with a space, it prints an error and refuses to prompt for anything besides the "complete" file, which is anything but complete.

Steps to reproduce

mkdir "Foo Bar"
cd "Foo Bar"
npm init

And then npm will error:

This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "Foo Bar": Tags may not have any characters that encodeURIComponent encodes.
About to write to C:\Users\Cameron\git\Foo Bar\package.json:

{
  "name": "",
  "version": ""
}


Is this ok? (yes) no
Aborted.

Expected Results

No error. Not a nearly empty package.json. I'd expect to be prompted with which name I'd like to use and appropriate handlers if I specify a space. As in, similar to the old behavior from 4.2.0.

Environment

Tested on Windows 10 with npm version 5.0.3 and 5.3.0. Also tested with linux.

Does not error on npm version 4.2.0

@addaleax
Copy link
Contributor

seems like #71 would fix this

@legodude17
Copy link
Contributor

And that was merged. @cinderblock do you still face this issue?

@cinderblock
Copy link
Author

npm 5.6.0, latest stable I can easily test, does not fix this issue.

@bhaveshvyas007
Copy link

Issue still exists

@allanbowe
Copy link

Issue still exists

@legodude17
Copy link
Contributor

I think #81 may have fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants