npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

package name includes capital letters when using -y option in npm init

What I Wanted to Do

Generate package.json with npm init -y.

What Happened Instead

package.json got created but the name property contained capital letters

Reproduction Steps

  1. Make a folder with capital letters in it’s name
  2. Run npm init -y in that folder
  3. Check the created package.json’s name property


C:\Users\Agent\Desktop>md ExampleFolder && cd ExampleFolder

C:\Users\Agent\Desktop\ExampleFolder>npm init -y
Wrote to C:\Users\Agent\Desktop\ExampleFolder\package.json:

  "name": "ExampleFolder",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "keywords": [],
  "author": "",
  "license": "ISC"

C:\Users\Agent\Desktop\ExampleFolder>type package.json | find /i "name"
  "name": "ExampleFolder",

C:\Users\Agent\Desktop\ExampleFolder>del * /s /q
Deleted file - C:\Users\Agent\Desktop\ExampleFolder\package.json

C:\Users\Agent\Desktop\ExampleFolder>npm init
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.
package name: (examplefolder) ExampleFolder
Sorry, name can no longer contain capital letters.

Platform Info

Windows 10, 64 bit.

$ npm --versions
  npm: '6.10.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  llhttp: '1.1.4',
  modules: '72',
  napi: '4',
  nghttp2: '1.39.1',
  node: '12.7.0',
  openssl: '1.1.1c',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.30.1',
  v8: '',
  zlib: '1.2.11'
$ node -p process.platform

Related issue due to taking folder name unmodified: