npm Community Forum (Archive)

The npm community forum has been discontinued.

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

npm ERR! Cannot read property 'match' of undefined

What I Wanted to Do

npm i

What Happened Instead

D:\MyDev\ljs_app\trunk\periscope\build>npm i
npm ERR! Cannot read property 'match' of undefined

2018-06-11T18_17_28_661Z-debug.log (120.5 KB)

When removing the package-lock.json file the installation works again one time and the next time i use npm i it is broken again.

Reproduction Steps

Using npm i with my configuration files.

(as a new user, i was only allowed to upload 1 file, so i had to skip the package.json files for now)*



{ periscope: '1.0.0',
  npm: '6.1.0',
  ares: '1.14.0',
  cldr: '33.0',
  http_parser: '2.8.0',
  icu: '61.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.29.0',
  node: '10.4.0',
  openssl: '1.1.0h',
  tz: '2018c',
  unicode: '10.0',
  uv: '1.20.3',
  v8: '',
  zlib: '1.2.11' }

package.json (3.1 KB)

package-lock.json (778.0 KB)

This has everything I could ask for, thank you! The proximate error can be fixed easily of course by adding a guard to the code in that stack trace. The root cause is more interesting and less obvious and is implies that there’s an entry in the package-lock.json that’s missing a version. Thankfully you’ve kindly provided the problematic file, so I’m sure we’ll get that part of it cleaned up pretty quickly too!

Wow! This is a quick feedback. Until now I always posted npm errors as a github SR but usually with very little or no feedback.
What was most surprising to me, is the fact that it happens each time and please notice, that i use exact version numbers in my package file.
Thank you!

Don’t get too used to this fast a feedback, it’s like midnight my time and I just happened to have the tab open. :stuck_out_tongue_closed_eyes: But yeah, we made this for many reasons, but one is to better manage reports. It’s still in trial stages right now, but that’ll be changing in the next month or so.

@iarna Removing the lock file AND the node_modules folder worked for me. Only removing the lock file only worked once.

Ahh, so that implies that a dependency got installed with a version missing in its package.json, which definitely shouldn’t be happening. If you run into it again, please say something!

I will report the error if it happens again. Any additional information that might be needed to track it down?
Thank you!

I have the same issue with npm-shrinkwrap.json. In my case, the shrinkwrap includes the following entry:

"fsevents": {
    "dependencies": {
        "rc": {}

When running npm install an exception with Cannot read property 'match' of undefined'is thrown. This is with npm 6.2.0 and node 8.9.4.

I’m aware of possibly highjacking this bug report with something that should or could be a separate bug report and I appologise if so, however it does look similar from my perspective and maybe two birds can be killed with one stone.

It’s the same file with two different names.