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] The `postinstall` script of dependencies fires before the `preinstall` script in package.json HOT 4
- [BUG] <title> HOT 1
- [BUG] When using the npm command in MacOS 15.0 Beta, the node icon appears in the Dock HOT 19
- G HOT 1
- [BUG] npm ci workspace broke node_modules
- [BUG] Ctrl+C / SIGINT propagation to child processes broken since 10.3.0 HOT 2
- [BUG] Npm progress bar is missing HOT 1
- [BUG] NPM LATEST VERSION Error
- [BUG] OpenBSD usage failure HOT 1
- corp-jones-damarcus:patch-1 HOT 1
- [BUG] `npm init` does not use locally installed version of given package. HOT 1
- https://github.com/npm/cli/commit/dbe7d983d184fb00c85f7b34839a123057029c8b HOT 2
- [DOCS] npm doesn't install the latest tagged version if engines are invalid HOT 6
- [BUG] npm dist-tag rm only removes the last recently deleted tag HOT 9
- [BUG] `npm publish --provenance` The default value `public` isn't used HOT 5
- [Enchancement] Check files that import the package before uninstalling HOT 1
- [BUG] npm docs with no pkgname arg returns undefined HOT 2
- [BUG] No README.md on npmjs ? HOT 4
- [BUG] Problem / error links are incorrect when path contains prefix before space HOT 3
- [BUG] npm version -ws never update dependencies in package.json HOT 3
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.