Skip to content

[BUG] npm link <package>: Cannot read properties of null (reading 'matches') #4367

@Ploppz

Description

@Ploppz

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Running npm link react in my library gives me the following output:

$ npm link react
npm ERR! Cannot read properties of null (reading 'matches')

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ploppz/.npm/_logs/2022-02-03T11_48_09_016Z-debug-0.log

And no link happens. The log:

Expected Behavior

No error, and symbolic link created in node_modules with name react

Steps To Reproduce

I have npm installed from official Arch repo.

I have an app called ui. I went into its node_modules/react after npm i and ran sudo npm link. As such, a symbolic link was created called /usr/lib/node_modules/react which points to this directory:

$ ls -l /usr/lib/node_modules
lrwxrwxrwx  1 root   root     49 Jan 31 14:30  react -> ../../../home/ploppz/ui/node_modules/react/
(rest redacted)

I have a shared library called components in which I need to link to this react installation, so I run npm link react in there and get the above problem.
npm link react worked fine yesterday with the same setup, and it still work perfectly fine in a second application I'm developing with the same components library... It's just in the components library itself it won't work.

Note that also the components library itself is linked with sudo npm link

Environment

  • npm: 8.3.2
  • Node.js: 17.3.0
  • OS Name: Arch Linux
  • System Model Name: ?
  • npm config:
; node bin location = /usr/bin/node
; cwd = /home/ploppz/components
; HOME = /home/ploppz
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issueRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions