Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: on global install, some get cannot set properties of null (setting 'dev') #175

Closed
rphovley opened this issue Aug 14, 2024 · 3 comments · Fixed by #177
Closed

Bug: on global install, some get cannot set properties of null (setting 'dev') #175

rphovley opened this issue Aug 14, 2024 · 3 comments · Fixed by #177
Assignees
Labels
bug Something isn't working urgent Important and needs to be completed asap

Comments

@rphovley
Copy link
Member

rphovley commented Aug 14, 2024

Replication Steps:

  • On a fresh install of Node 20, run npm i -g codeclimbers
  • Should see error
Screenshot 2024-08-14 at 10 55 59 AM

current workaround is to update npm (npm i -g npm) and rerun npm i -g codeclimbers. For reasons I haven't uncovered yet, this solves the issue (changelog between npm 10.8.1 and 10.8.2 don't have anything that seems relevant to the error)

Full Stack Trace:

0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using npm@10.8.1
2 info using node@v20.16.0
3 silly config load:file:/usr/local/lib/node_modules/npm/npmrc
4 silly config load:file:/Users/paulhovley/.npmrc
5 silly config load:file:/usr/local/etc/npmrc
6 verbose title npm i publishing-workspaces-test
7 verbose argv "i" "--global" "publishing-workspaces-test"
8 verbose logfile logs-max:10 dir:/Users/paulhovley/.npm/_logs/2024-08-16T00_22_40_359Z-
9 verbose logfile /Users/paulhovley/.npm/_logs/2024-08-16T00_22_40_359Z-debug-0.log
10 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
11 silly logfile start cleaning logs, removing 1 files
12 silly logfile done cleaning log files
13 silly idealTree buildDeps
14 silly fetch manifest publishing-workspaces-test@*
15 silly packumentCache full:https://registry.npmjs.org/publishing-workspaces-test cache-miss
16 http fetch GET 200 https://registry.npmjs.org/publishing-workspaces-test 414ms (cache updated)
17 silly packumentCache full:https://registry.npmjs.org/publishing-workspaces-test set size:undefined disposed:false
18 silly placeDep ROOT publishing-workspaces-test@1.0.1 OK for:  want: *
19 silly fetch manifest @me/server@file:packages/server
20 silly placeDep node_modules/publishing-workspaces-test @me/server@ OK for: publishing-workspaces-test@1.0.1 want: file:packages/server
21 silly reify moves {}
22 silly tarball no local data for publishing-workspaces-test@https://registry.npmjs.org/publishing-workspaces-test/-/publishing-workspaces-test-1.0.1.tgz. Extracting by manifest.
23 http fetch GET 200 https://registry.npmjs.org/publishing-workspaces-test/-/publishing-workspaces-test-1.0.1.tgz 96ms (cache miss)
24 verbose stack TypeError: Cannot set properties of null (setting 'dev')
24 verbose stack     at calcDepFlagsStep (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:34:21)
24 verbose stack     at visit (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:12:20)
24 verbose stack     at visitNode (/usr/local/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:58:25)
24 verbose stack     at next (/usr/local/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:44:19)
24 verbose stack     at depth (/usr/local/lib/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:83:10)
24 verbose stack     at depth (/usr/local/lib/node_modules/npm/node_modules/treeverse/lib/depth.js:27:12)
24 verbose stack     at calcDepFlags (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:10:15)
24 verbose stack     at Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:232:7)
24 verbose stack     at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5)
24 verbose stack     at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9)
25 error Cannot set properties of null (setting 'dev')
26 silly unfinished npm timer reify 1723767760788
27 verbose cwd /usr/local/bin
28 verbose os Darwin 23.5.0
29 verbose node v20.16.0
30 verbose npm  v10.8.1
31 verbose exit 1
32 verbose code 1
33 error A complete log of this run can be found in: /Users/paulhovley/.npm/_logs/2024-08-16T00_22_40_359Z-debug-0.log
@rphovley rphovley added the urgent Important and needs to be completed asap label Aug 14, 2024
@rphovley
Copy link
Member Author

rphovley commented Aug 14, 2024

Might have something to do with:

npm/cli#4064 (comment)
npm/cli#3847

EDIT: These are old but also seem to hint at setting symlinks correctly

@rphovley rphovley self-assigned this Aug 14, 2024
@rphovley rphovley mentioned this issue Aug 15, 2024
10 tasks
@rphovley rphovley added the bug Something isn't working label Aug 16, 2024
@rphovley
Copy link
Member Author

rphovley commented Aug 16, 2024

Some deeper looks seem to indicate that this file symlink is not working on the global install

24 verbose stack TypeError: Cannot set properties of null (setting 'dev')
24 verbose stack     at calcDepFlagsStep (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js:34:21)

The issue occurs in this code

  if (node.isLink) {
    node.target.dev = node.dev // node.target is null
    node.target.optional = node.optional
    node.target.devOptional = node.devOptional
    node.target.peer = node.peer
    return calcDepFlagsStep(node.target)
  }

This PR has some cleanup that makes better use of workspaces, but the end result has been the same with it that the internal file dependencies aren't working
https://github.com/CodeClimbersIO/cli/pull/176/files

@rphovley
Copy link
Member Author

Also, made a stackoverflow to see if we get any bites: Edits welcome
https://stackoverflow.com/questions/78877405/title-npm-global-install-fails-for-monorepo-with-workspace-dependencies

And a minimally reproducable simple repo
https://github.com/rphovley/publishing-workspaces-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working urgent Important and needs to be completed asap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant