question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm error trying to init in node 15.0.1

See original GitHub issue

Initializing a new project cdk init app --language typescript fails on macOS 10.15.7 using node 15.0.1 and npm 7.0.3 with error “Cannot read property ‘matches’ of undefined”.

Reproduction Steps

Running node 15.0.1 and npm 7.0.3 on macOS 10.15.7 npm i -g aws-cdk cd empty-folder cdk init app --language typescript

What did you expect to happen?

Project initialised without errors

What actually happened?

Output error “Cannot read property ‘matches’ of undefined” in console, and the following in debug log

291 verbose stack TypeError: Cannot read property 'matches' of undefined
291 verbose stack     at Arborist.[canPlaceDep] (/Users/julianminde/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1284:15)
291 verbose stack     at Arborist.[placeDep] (/Users/julianminde/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1061:36)
291 verbose stack     at Arborist.[placeDep] (/Users/julianminde/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1212:41)
291 verbose stack     at /Users/julianminde/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:766:46
291 verbose stack     at Array.map (<anonymous>)
291 verbose stack     at Arborist.[buildDepStep] (/Users/julianminde/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:766:8)
291 verbose stack     at async Arborist.buildIdealTree (/Users/julianminde/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:202:7)
291 verbose stack     at async Promise.all (index 1)
291 verbose stack     at async Arborist.reify (/Users/julianminde/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:121:5)
291 verbose stack     at async install (/Users/julianminde/.nvm/versions/node/v15.0.1/lib/node_modules/npm/lib/install.js:40:5)
292 verbose cwd /Users/julianminde/aws/hello-cdk
293 verbose Darwin 19.6.0
294 verbose argv "/Users/julianminde/.nvm/versions/node/v15.0.1/bin/node" "/Users/julianminde/.nvm/versions/node/v15.0.1/bin/npm" "install"
295 verbose node v15.0.1
296 verbose npm  v7.0.3
297 error Cannot read property 'matches' of undefined
298 verbose exit 1

Environment

  • CLI Version : aws-cli/2.0.56 Python/3.7.4 Darwin/19.6.0 exe/x86_64
  • Framework Version: 1.71.0 (build 953bc25)
  • Node.js Version: 15.0.1
  • OS : macOS 10.15.7
  • Language (Version):

Other

I still fear this being a problem with my environment, however I have tried installing node both from brew and using nvm with the same results, and when I use nvm with node version 14.15.0 it seems to work fine.


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
sanniescommented, Nov 1, 2020

I ran into the same issue. After npm install -g npm@latest I could no longer reproduce. Perhaps you want to give it a try.

1reaction
pgolluccicommented, Nov 1, 2020

This is an npm 7.x issue. npm@latest is still on 6.x

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected token '.' when trying to run 'npm install'
Based on the github issue link, the fix is to upgrade nvm for windows to 1.1.10, and then remove (all?) node version and...
Read more >
Common errors | npm Docs
Possible temporary npm registry glitch, or corrupted local server cache. Run npm cache clean and/or try again later. · This can be caused...
Read more >
Npm install command failing with message "could not find ...
When I run the npm install command, npm starts downloading the dependencies. But then, suddenly, it stops with the error:
Read more >
How to Install npm, Master npm Commands & Use Packages
This step-by-step guide will show you how to install npm, and master common commands in the Node Package Manager (npm) command-line ...
Read more >
Errors | Node.js v19.3.0 Documentation
The JavaScript try…catch mechanism cannot be used to intercept errors generated by ... Initialization of an asynchronous crypto operation failed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found