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

[BUG] TypeError: Cannot read property 'match' of undefined #973

Closed
theADAMJR opened this issue Mar 4, 2020 · 3 comments
Closed

[BUG] TypeError: Cannot read property 'match' of undefined #973

theADAMJR opened this issue Mar 4, 2020 · 3 comments

Comments

@theADAMJR
Copy link

theADAMJR commented Mar 4, 2020

What / Why

Angular 9.0.2
NodeJS: 13.9.0
npm: 6.13.7

When

  • Whenever I install an npm package with an existing package-lock.json
  • After typing git push heroku master

Where

How

Current Behavior

  • Failure to deploy on Heroku (most of the time)

Steps to Reproduce

  • Install any npm package with package-lock.json (using this project)

Expected Behavior

  • TypeError: Cannot read property 'match' of undefined

Who

  • Me

References

  • n/a
@DullReferenceException
Copy link

Here's some logs for this error that might help:

19 verbose stack TypeError: Cannot read property 'match' of undefined
19 verbose stack     at tarballToVersion (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:87:20)
19 verbose stack     at inflatableChild (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:99:22)
19 verbose stack     at /home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:55:12
19 verbose stack     at tryCatcher (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
19 verbose stack     at Object.gotValue (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:155:18)
19 verbose stack     at Object.gotAccum (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:144:25)
19 verbose stack     at Object.tryCatcher (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
19 verbose stack     at Promise._settlePromiseFromHandler (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:517:31)
19 verbose stack     at Promise._settlePromise (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:574:18)
19 verbose stack     at Promise._settlePromise0 (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:619:10)
19 verbose stack     at Promise._settlePromises (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:699:18)
19 verbose stack     at _drainQueueStep (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12)
19 verbose stack     at _drainQueue (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
19 verbose stack     at Async._drainQueues (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)
19 verbose stack     at Immediate.Async.drainQueues [as _onImmediate] (/home/jpage/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
19 verbose stack     at processImmediate (internal/timers.js:456:21)
20 verbose cwd /home/jpage/Code/vnext-api
21 verbose Linux 4.4.0-18362-Microsoft
22 verbose argv "/home/jpage/.nvm/versions/node/v12.16.1/bin/node" "/home/jpage/.nvm/versions/node/v12.16.1/bin/npm" "audit" "fix"
23 verbose node v12.16.1
24 verbose npm  v6.14.2
25 error Cannot read property 'match' of undefined
26 verbose exit [ 1, true ]

@DullReferenceException
Copy link

From that stack, it looks like the problem is that sw.version is undefined here:

https://github.com/npm/cli/blob/latest/lib/install/inflate-shrinkwrap.js#L99

@DullReferenceException
Copy link

Found the culprit. Somehow, the lockfile had a malformed dependency saved. Looked like:

"rc": {}

After removing that, npm install worked once again.

I believe it was an npm audit fix that was run just prior to that, but will try to keep better track of which exact step produced 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

2 participants