npm / npm/cli

[BUG] Cannot read properties of undefined (reading 'spec')

Open
#4,819 15 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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

I develop a nextjs application. I want to use react-table package specific version from github. I tried the below command in the terminal:

npm install git://github.com/tanstack/react-table.git#v8.0.0-alpha.51

It starts to download but stucked after a while and ended with the error Cannot read properties of undefined (reading 'spec')

Here is the npm log:

49 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-win32-x64-msvc
50 silly reify mark deleted [
50 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-win32-x64-msvc'
50 silly reify ]
51 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-win32-ia32-msvc
52 silly reify mark deleted [
52 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-win32-ia32-msvc'
52 silly reify ]
53 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-win32-arm64-msvc
54 silly reify mark deleted [
54 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-win32-arm64-msvc'
54 silly reify ]
55 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-x64-musl
56 silly reify mark deleted [
56 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-x64-musl'
56 silly reify ]
57 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-x64-gnu
58 silly reify mark deleted [
58 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-x64-gnu'
58 silly reify ]
59 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-arm64-musl
60 silly reify mark deleted [
60 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-arm64-musl'
60 silly reify ]
61 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-arm64-gnu
62 silly reify mark deleted [
62 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-arm64-gnu'
62 silly reify ]
63 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-arm-gnueabihf
64 silly reify mark deleted [
64 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-linux-arm-gnueabihf'
64 silly reify ]
65 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-darwin-arm64
66 silly reify mark deleted [
66 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-darwin-arm64'
66 silly reify ]
67 verbose reify failed optional dependency /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-android-arm64
68 silly reify mark deleted [
68 silly reify   '/Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web/node_modules/@next/swc-android-arm64'
68 silly reify ]
69 timing reifyNode:node_modules/@next/swc-win32-x64-msvc Completed in 21ms
70 timing reifyNode:node_modules/@next/swc-win32-ia32-msvc Completed in 21ms
71 timing reifyNode:node_modules/@next/swc-win32-arm64-msvc Completed in 22ms
72 timing reifyNode:node_modules/@next/swc-linux-x64-musl Completed in 22ms
73 timing reifyNode:node_modules/@next/swc-linux-x64-gnu Completed in 22ms
74 timing reifyNode:node_modules/@next/swc-linux-arm64-musl Completed in 21ms
75 timing reifyNode:node_modules/@next/swc-linux-arm64-gnu Completed in 21ms
76 timing reifyNode:node_modules/@next/swc-linux-arm-gnueabihf Completed in 21ms
77 timing reifyNode:node_modules/@next/swc-darwin-arm64 Completed in 21ms
78 timing reifyNode:node_modules/@next/swc-android-arm64 Completed in 21ms
79 http fetch GET 200 https://codeload.github.com/tanstack/react-table/tar.gz/a642b36b4faff416d17a5a22a11682772afa2572 521ms (cache revalidated)
80 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 642ms
81 timing auditReport:getReport Completed in 651ms
82 silly audit report {
82 silly audit report   underscore: [
82 silly audit report     {
82 silly audit report       id: 1068134,
82 silly audit report       url: 'https://github.com/advisories/GHSA-cf4h-3jhx-xvhq',
82 silly audit report       title: 'Arbitrary Code Execution in underscore',
82 silly audit report       severity: 'high',
82 silly audit report       vulnerable_versions: '>=1.3.2 <1.12.1',
82 silly audit report       cwe: [Array],
82 silly audit report       cvss: [Object]
82 silly audit report     }
82 silly audit report   ]
82 silly audit report }
83 timing metavuln:cache:get:security-advisory:underscore:Gnjmi1IOOUemQLeLgz5wRwLH47Eo9UznXoQR7+paJUZ5akz/mDNxKZhNia4PfEO25soJ4Pui+zZrnP/UDRFcrg== Completed in 3ms
84 http fetch GET 200 https://registry.npmjs.org/underscore 99ms (cache revalidated)
85 timing metavuln:packument:underscore Completed in 99ms
86 timing metavuln:load:security-advisory:underscore:1068134 Completed in 1ms
87 timing metavuln:calculate:security-advisory:underscore:1068134 Completed in 101ms
88 timing metavuln:cache:get:security-advisory:nomnom:DQUhFjyX429qptn/n8Uhfq7YeZIdBe9/qacpIYBWZ2pIHThXVcKYs0RH5u7CWrWBHCMXnb5SXhAcRszvQ9hi6g== Completed in 2ms
89 http fetch GET 200 https://registry.npmjs.org/nomnom 89ms (cache revalidated)
90 timing metavuln:packument:nomnom Completed in 89ms
91 timing metavuln:load:security-advisory:nomnom:Gnjmi1IOOUemQLeLgz5wRwLH47Eo9UznXoQR7+paJUZ5akz/mDNxKZhNia4PfEO25soJ4Pui+zZrnP/UDRFcrg== Completed in 0ms
92 timing metavuln:calculate:security-advisory:nomnom:Gnjmi1IOOUemQLeLgz5wRwLH47Eo9UznXoQR7+paJUZ5akz/mDNxKZhNia4PfEO25soJ4Pui+zZrnP/UDRFcrg== Completed in 89ms
93 timing metavuln:cache:get:security-advisory:local-ssl-proxy:ofKTNzg2i4mGw/PKqqfCg/6pbQW50RjEeKeGZZ6obFI7sSCOXuX0wG4lQEigM0ScX2Nf8gr1Guioi7wIQ29fkQ== Completed in 2ms
94 http fetch GET 200 https://registry.npmjs.org/local-ssl-proxy 91ms (cache revalidated)
95 timing metavuln:packument:local-ssl-proxy Completed in 91ms
96 timing metavuln:load:security-advisory:local-ssl-proxy:DQUhFjyX429qptn/n8Uhfq7YeZIdBe9/qacpIYBWZ2pIHThXVcKYs0RH5u7CWrWBHCMXnb5SXhAcRszvQ9hi6g== Completed in 0ms
97 timing metavuln:calculate:security-advisory:local-ssl-proxy:DQUhFjyX429qptn/n8Uhfq7YeZIdBe9/qacpIYBWZ2pIHThXVcKYs0RH5u7CWrWBHCMXnb5SXhAcRszvQ9hi6g== Completed in 92ms
98 timing auditReport:init Completed in 286ms
99 timing reify:audit Completed in 937ms
100 timing reifyNode:node_modules/undefined Completed in 83750ms
101 timing reify:unpack Completed in 83752ms
102 timing reify:unretire Completed in 0ms
103 timing build:queue Completed in 49ms
104 timing build:deps Completed in 50ms
105 timing build Completed in 50ms
106 timing reify:build Completed in 51ms
107 timing reify:trash Completed in 1729ms
108 timing command:install Completed in 90889ms
109 verbose stack TypeError: Cannot read properties of undefined (reading 'spec')
109 verbose stack     at updateNodes (/Users/talatkuyuk/.nvm/versions/node/v16.15.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1177:44)
109 verbose stack     at Arborist.[saveIdealTree] (/Users/talatkuyuk/.nvm/versions/node/v16.15.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1344:11)
109 verbose stack     at Arborist.reify (/Users/talatkuyuk/.nvm/versions/node/v16.15.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:156:31)
109 verbose stack     at async Install.exec (/Users/talatkuyuk/.nvm/versions/node/v16.15.0/lib/node_modules/npm/lib/commands/install.js:159:5)
109 verbose stack     at async module.exports (/Users/talatkuyuk/.nvm/versions/node/v16.15.0/lib/node_modules/npm/lib/cli.js:66:5)
110 verbose cwd /Users/talatkuyuk/MyCodeRepo/nextprojects/amazon-ht-web
111 verbose Darwin 19.6.0
112 verbose argv "/Users/talatkuyuk/.nvm/versions/node/v16.15.0/bin/node" "/Users/talatkuyuk/.nvm/versions/node/v16.15.0/bin/npm" "install" "git://github.com/tanstack/react-table.git#v8.0.0-alpha.51"
113 verbose node v16.15.0
114 verbose npm  v8.5.5
115 error Cannot read properties of undefined (reading 'spec')
116 verbose exit 1
117 timing npm Completed in 91074ms
118 verbose unfinished npm timer reify 1651116372524
119 verbose unfinished npm timer reify:save 1651116463410
120 verbose code 1
121 error A complete log of this run can be found in:
121 error     /Users/talatkuyuk/.npm/_logs/2022-04-28T03_26_12_342Z-debug-0.log
Expected Behavior

I expect the npm install the react-table package from GitHub

Steps To Reproduce
  1. It is nextjs application
  2. Run 'npm install git://github.com/tanstack/react-table.git#v8.0.0-alpha.51'
  3. See error...Cannot read properties of undefined (reading 'spec')
Environment
  • npm: v8.5.5
  • Node.js: v16.15.0
  • OS Name: MacBook Pro
  • System Model Name: Mac OS
  • npm config:
; node bin location = /Users/talatkuyuk/.nvm/versions/node/v16.15.0/bin/node
; cwd = /Users/talatkuyuk/.nvm/versions/node/v16.15.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist
; HOME = /Users/talatkuyuk
; Run `npm config ls -l` to show all defaults.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with npm v8.5.5, Node.js v16.15.0, and the GitHub install command, then inspect @npmcli/arborist/lib/arborist/reify.js around updateNodes and saveIdealTree. Done means the react-table tag installs successfully without the "reading 'spec'" TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.