1

I am migrating to a new (virtual) Windows 10 machine, and have got to the stage of installing Electron.

I have successfully installed node.js (node-v16.16.0-x64.msi) into C:\Program Files and now have a cmd prompt.

When I run

npm update npm

I get the following error:

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! Tracker "idealTree" already exists

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mark\AppData\Local\npm-cache\_logs\2022-07-21T05_48_27_188Z-debug-0.log

I get the same error if I try installing anything with npm, but this is the same problem after a fresh install.

Is there a bug with npm or is there something magical I’m not doing right?

Manngo
  • 14,066
  • 10
  • 88
  • 110
  • `node -v; npm -v; which node; which npm;`? – JBallin Jul 21 '22 at 06:14
  • Did you do this: "Run the downloaded Node.js .msi Installer - including accepting the license, selecting the destination, and authenticating for the install."? – JBallin Jul 21 '22 at 06:16
  • @JBallin `node -v`:` v16.16.0`; `npm -v`: `npm WARN config global `--global`, `--local` are deprecated. Use --location=global instead. 8.11.0`; Windows doesn’t have `which`, but this is a fresh install. – Manngo Jul 21 '22 at 06:17
  • @JBallin I did, and the fact that `npm` gives me any messages at all suggest that Node and npm were installed. – Manngo Jul 21 '22 at 06:19
  • Have you checked out https://github.com/coreybutler/nvm-windows – JBallin Jul 21 '22 at 06:19
  • `npm config list`? https://docs.npmjs.com/cli/v8/commands/npm-config – JBallin Jul 21 '22 at 06:20
  • Does this answer your question? [npm ERR! Tracker "idealTree" already exists while creating the Docker image for Node project](https://stackoverflow.com/questions/57534295/npm-err-tracker-idealtree-already-exists-while-creating-the-docker-image-for) – JBallin Jul 21 '22 at 06:23
  • Why does user agent show other node and npm versions? – JBallin Jul 21 '22 at 06:25
  • You don't need to update npm. What task are you trying to accomplish? – JBallin Jul 21 '22 at 06:26
  • Sorry, I was in the wrong virtual machine. the correct config only has the following uncommented: `prefix = "C:\\Users\\mark\\AppData\\Roaming\\npm"`. I don’t need to update npm, but I was testing npm after several other failed attempts. I am really trying to install electron-builder. – Manngo Jul 21 '22 at 06:34
  • You're trying to install the pkg within a folder that has a package.json, right? Can you show the output of what happens when you try that? – JBallin Jul 21 '22 at 15:31

1 Answers1

0

This is due to the version problem of NPM. if you are using windows then you can follow this:

  1. Go to folder C:\Program Files\nodejs

  2. You have to edit four files named npm, npm.cmd, npx, npx.cmd

  3. Open the files in a text editor, like Visual Studio Code

  4. Replace prefix -g with prefix --location=global in all four files

  5. After this Run this command

    npm i latest-version

Manngo
  • 14,066
  • 10
  • 88
  • 110
yanir midler
  • 2,153
  • 1
  • 4
  • 16
  • Try deleting node_modules and then running npm install? – JBallin Jul 21 '22 at 15:32
  • I made changes you mentioned. I can successfully install `electron-builder` with `npm install -g electron-builder`, but running your last command gives me a -4071 error: `EINVAL: invalid argument, rename '…' -> '…'`. – Manngo Jul 22 '22 at 05:59