Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm init ERR Cannot call method 'join' of undefined (init-package-json/default-input.js:51:45) #7927

Closed
shawninder opened this issue Apr 12, 2015 · 8 comments

Comments

@shawninder
Copy link

It's the first time I ever see npm init fail. I must say I'm really surprised as I didn't update npm or anything either.

Also, it only fails in one directory. If I go to a different directory and do the same thing, it works just fine. The directory in which it doesn't work doesn't have anything special in it either, just a few files, a few directories, and .git directory.

Basically, I just ran npm init, pressed enter to keep the default package name, and it failed. I then cat npm-debug.log. The full output is below.

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

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

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

Press ^C at any time to quit.
name: (gitAsBackend)
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/Users/shawn/npm/bin/npm" "init"
npm ERR! node v0.10.31
npm ERR! npm  v2.7.6

npm ERR! Cannot call method 'join' of undefined
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/shawn/Work/gitAsBackend/npm-debug.log
$ cat npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/Users/shawn/npm/bin/npm', 'init' ]
2 info using npm@2.7.6
3 info using node@v0.10.31
4 silly package data undefined
5 info init written successfully
6 verbose type non_object_property_call
7 verbose stack TypeError: Cannot call method 'join' of undefined
7 verbose stack     at exports.name (/Users/shawn/npm/lib/node_modules/npm/node_modules/init-package-json/default-input.js:51:45)
7 verbose stack     at PromZard.<anonymous> (/Users/shawn/npm/lib/node_modules/npm/node_modules/init-package-json/node_modules/promzard/promzard.js:226:19)
7 verbose stack     at Interface.onLine (/Users/shawn/npm/lib/node_modules/npm/node_modules/read/lib/read.js:111:5)
7 verbose stack     at Interface.emit (events.js:95:17)
7 verbose stack     at Interface._onLine (readline.js:202:10)
7 verbose stack     at Interface._line (readline.js:531:8)
7 verbose stack     at Interface._ttyWrite (readline.js:760:14)
7 verbose stack     at ReadStream.onkeypress (readline.js:99:10)
7 verbose stack     at ReadStream.emit (events.js:98:17)
7 verbose stack     at emitKey (readline.js:1095:12)
8 verbose cwd /Users/shawn/Work/gitAsBackend
9 error Darwin 14.0.0
10 error argv "node" "/Users/shawn/npm/bin/npm" "init"
11 error node v0.10.31
12 error npm  v2.7.6
13 error Cannot call method 'join' of undefined
14 error If you need help, you may report this error at:
14 error     <https://github.com/npm/npm/issues>
15 verbose exit [ 1, true ]
@iarna
Copy link
Contributor

iarna commented Apr 12, 2015

You've stepped into a bug in the error reporting in in init-package-json.

The error that it's failing to report is that we don't allow capital letters in package names. Node modules typically use kebob case, so a more idiomatic package name would be git-as-backend.

Meanwhile, I've created a bug report over at npm/init-package-json#37

When it's fixed it'll find its way back into npm soon after.

I'm going to close this ticket in favor of the one over at init-package-json. Thanks for reporting this!

@iarna iarna closed this as completed Apr 12, 2015
@chetandhembre
Copy link

Thanks for answer..but It would be nice if "package name should be capital" be message in error .. I just spent 15 minutes in uninstalling / reinstalling npm . Finally bump onto this issue.
Can you please fix it ?

@shawninder
Copy link
Author

The way I see it, it will be fixed via iarna's bug report. Thanks iarna

@Maik-Verge
Copy link

Thanks Shawn and Iarna, just ran into this myself, I thought I was going crazy for a minute.

@michaelmcmillan
Copy link

Yep, here as well. Please make this into an error message.

@Fishrock123
Copy link
Contributor

Looks like this was fixed in npm/init-package-json#40 / 98ad98c / 2.10.0

@glzcc
Copy link

glzcc commented Aug 4, 2015

I don't know!

@glzcc
Copy link

glzcc commented Aug 4, 2015

The version is too low

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

No branches or pull requests

7 participants