Comments (8)
I've run into this problem too. I have a repro here:
$ git clone [email protected]:felix9/npm-link-bug-1
$ git clone [email protected]:felix9/npm-link-bug-2
$ cd npm-link-bug-1
$ npm link
$ cd ../npm-link-bug-2
$ npm link npm-link-bug-1
$ npm install
npm ERR! Cannot read property '0' of undefined
This is where the error happens:
Lines 60 to 61 in f533d61
The parent package is requesting a git package with a gitRange.
The child package doesn't have a _from because linked packages don't have _from, so npm calls
npa(undefined)
I'm unsure what the right fix is.
from cli.
@felix9 I think the second clone is supposed to be npm-link-bug-2
you have -1
twice.
from cli.
oops, yeah, fixed.
from cli.
Ah, fantastic, it's been nagging at me that we don't have a repro case for that npa bug.
Thanks!
from cli.
Does this mean that git hosted repos with gitRange should be avoided?
Just added one of these to my project and started noticing the error.
cat ~/.npm/_logs/2020-12-16T05_17_25_293Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'outdated' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 695d8a0006d4fbbf
5 verbose stack TypeError: Cannot read property '0' of undefined
5 verbose stack at npa (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:34:25)
5 verbose stack at doesChildVersionMatch (/usr/local/lib/node_modules/npm/lib/install/deps.js:61:22)
5 verbose stack at versionMatch (/usr/local/lib/node_modules/npm/lib/install/deps.js:762:12)
5 verbose stack at Array.filter (<anonymous>)
5 verbose stack at exports.findRequirement (/usr/local/lib/node_modules/npm/lib/install/deps.js:772:23)
5 verbose stack at findChild (/usr/local/lib/node_modules/npm/lib/install/deps.js:125:17)
5 verbose stack at computeMetadata (/usr/local/lib/node_modules/npm/lib/install/deps.js:135:9)
5 verbose stack at /usr/local/lib/node_modules/npm/lib/outdated.js:81:16
5 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-tree/rpt.js:162:20
6 verbose cwd ~/projects/pantheon/wellness
7 verbose Darwin 19.6.0
8 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "outdated"
9 verbose node v14.15.0
10 verbose npm v6.14.5
11 error Cannot read property '0' of undefined
12 verbose exit [ 1, true ]
Is there a patch for const sameRepo = npa(child.package._from).fetchSpec === requested.fetchSpec
that doesn't depend on the nonexistent child.packge._from
value?
from cli.
I've run into this problem too. I have a repro here:
$ git clone [email protected]:felix9/npm-link-bug-1 $ git clone [email protected]:felix9/npm-link-bug-2 $ cd npm-link-bug-1 $ npm link $ cd ../npm-link-bug-2 $ npm link npm-link-bug-1 $ npm install npm ERR! Cannot read property '0' of undefined
This is where the error happens:
Lines 60 to 61 in f533d61
The parent package is requesting a git package with a gitRange.
The child package doesn't have a _from because linked packages don't have _from, so npm callsnpa(undefined)
I'm unsure what the right fix is.
How did you fix this problem?
from cli.
@VitaliyDemchuk I never found a fix or workaround, I just gave up on using npm link
from cli.
@felix9 I used this hack, but it is a very bad solution and I would like to find a more acceptable option.
from cli.
Related Issues (20)
- [BUG] `npm pkg fix` does not fix invalid `scripts` warning. HOT 1
- [BUG] In v9, installing from packages directly from Github via SSH is so much slower than before HOT 1
- [BUG] `npm audit` erroneously reports issue when workspace named the same as an npm package HOT 2
- npm WARN EBADENGINE Unsupported engine HOT 3
- Error: Warning: Ignoring extra certs HOT 2
- Error when tried to download artillery HOT 1
- [BUG] bundleddepencencies does not bundle dependencies in my monorepo HOT 1
- [BUG] <title> report 'no matching version found' error during second npm install
- [BUG] missing npm packages while installing [email protected] with cft 119.0.6045.105 using --prefix
- [BUG] peerDependencies of package behave like dependencies when package is locally installed HOT 1
- [BUG] Unable to configure hook HOT 1
- [BUG] Issues running npm run dev in WSL2 HOT 1
- npm link with monorepo only links at the root
- [BUG] Offline update of form 6.x to 9.8.1 version
- [BUG] Unable to install packages because of Unable to resolve reference $@types/react-dom HOT 4
- [BUG] NPX command sometime it can't find packages HOT 1
- [DOCS] prepare hook not documented for `npm ci`
- I can't reset password
- [DOCS] The latest version of python (3.12) doesn't support node-gyp HOT 2
- 24 packages are looking for funding and npm WARN cli npm v10.3.0 does not support Node.js v18.16.1. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.