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

Missing required argument #2 #9669

Closed
mashlol opened this issue Sep 19, 2015 · 5 comments
Closed

Missing required argument #2 #9669

mashlol opened this issue Sep 19, 2015 · 5 comments
Assignees
Milestone

Comments

@mashlol
Copy link

mashlol commented Sep 19, 2015

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'install' ]
2 info using npm@3.3.3
3 info using node@v4.0.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly install normalizeTree
8 verbose stack Error: Missing required argument #2
8 verbose stack     at exports.findRequirement (/usr/local/lib/node_modules/npm/lib/install/deps.js:475:3)
8 verbose stack     at /usr/local/lib/node_modules/npm/lib/install/deps.js:90:19
8 verbose stack     at zalgoSafe (/usr/local/lib/node_modules/npm/node_modules/dezalgo/dezalgo.js:20:10)
8 verbose stack     at finalize (/usr/local/lib/node_modules/npm/node_modules/realize-package-specifier/index.js:37:5)
8 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/realize-package-specifier/index.js:22:20
8 verbose stack     at FSReqWrap.oncomplete (fs.js:82:15)
9 verbose cwd /var/www/html/omni2.1/example
10 error Linux 3.13.0-32-generic
11 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
12 error node v4.0.0
13 error npm  v3.3.3
14 error code EMISSINGARG
15 error typeerror Error: Missing required argument #2
15 error typeerror     at exports.findRequirement (/usr/local/lib/node_modules/npm/lib/install/deps.js:475:3)
15 error typeerror     at /usr/local/lib/node_modules/npm/lib/install/deps.js:90:19
15 error typeerror     at zalgoSafe (/usr/local/lib/node_modules/npm/node_modules/dezalgo/dezalgo.js:20:10)
15 error typeerror     at finalize (/usr/local/lib/node_modules/npm/node_modules/realize-package-specifier/index.js:37:5)
15 error typeerror     at /usr/local/lib/node_modules/npm/node_modules/realize-package-specifier/index.js:22:20
15 error typeerror     at FSReqWrap.oncomplete (fs.js:82:15)
15 error typeerror This is an error with npm itself. Please report this error at:
15 error typeerror     <http://github.com/npm/npm/issues>
16 verbose exit [ 1, true ]

I had a local dependency listed in my package.json, like this:

{
  "dependencies": {
    "../": "",
  }
}

which was working on my Windows machine but when I went to deploy it I was getting odd errors during npm install related to not being able to find the required module. So I upgraded npm, and after that I got the error listed above when trying npm install.

I've realized now that I don't really need that dependency at all, but I figured its still worth reporting, especially since the error tells me to :).

@othiym23 othiym23 added the bug label Sep 19, 2015
@othiym23 othiym23 added this to the 3.x milestone Sep 19, 2015
@othiym23
Copy link
Contributor

I'm pretty sure that that code working in npm@2 was an accident. Looking through the stacktrace, it's apparent what the bug is, and it's due to the fact that not including an actual semver range is invalid. That said, the error message you're getting is unhelpful (to users – it's an internal validation function that's throwing up), so we should do a better job or indicating what happened here.

tmct added a commit to tmct/npm that referenced this issue Sep 22, 2015
@tmct
Copy link
Contributor

tmct commented Sep 22, 2015

Hello! I've had a look into this (just trying out open-source contribution!) and have discovered a few things:

  • It even happens when you include a valid semver range, e.g. "..": "4",
  • It looks like what's happening is that realize-package-arg(/npm-package-arg) is returning an object with a null name in some situations, which the calling code isn't expecting because there's no error.
  • When I make the change to treat a null name as a failure to find the module the user instead sees this:
thomas$ npm install
npm ERR! addLocal Could not install /Users/thomas/openSource/npm/.@4
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/4.1.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.1.0
npm ERR! npm  v3.3.4
npm ERR! path /Users/thomas/openSource/npm/.@4
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/Users/thomas/openSource/npm/.@4'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/thomas/openSource/npm/npm-debug.log

Which seems more helpful? I've put a pull request up. Thanks!

@iarna
Copy link
Contributor

iarna commented Sep 25, 2015

npm ERR! addLocal Could not install /Users/thomas/openSource/npm/.@4

I'm concerned that it's somehow translating ..@4 into .@4 – that seems pretty weird.

Overall, I think this is pointing at a refactor of the npm-package-arg / realize-package-specifier duality. Wanders off to the roadmap…

@tmct
Copy link
Contributor

tmct commented Sep 25, 2015

Ah. That ../. discrepancy is just me copying-and-pasting badly after trying two different things. Please ignore that...

@iarna
Copy link
Contributor

iarna commented Sep 25, 2015

oh good!

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

No branches or pull requests

4 participants