0

I am getting this error when install the node modules(npm install). Why this issue happening in react native project? Is this related to node version ?

Error :

npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name ">=^16.8.1": Tags may not have any characters that encodeURIComponent encodes. npm ERR! A complete log of this run can be found in: /Users/abcdef/.npm/_logs/2021-08-02T05_31_11_609Z-debug.log

Error Log (debug.log)

109 verbose stack Error: Invalid tag name ">=^16.8.1": Tags may not have any characters that encodeURIComponent encodes. 109 verbose stack at invalidTagName (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:89:15) 109 verbose stack at fromRegistry (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:343:13) 109 verbose stack at Function.resolve (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:80:12) 109 verbose stack at Arborist.[nodeFromEdge] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:949:37) 109 verbose stack at async Arborist.[loadPeerSet] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1170:23) 109 verbose stack at async Arborist.[buildDepStep] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:886:11) 109 verbose stack at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7) 109 verbose stack at async Promise.all (index 1) 109 verbose stack at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:134:5) 109 verbose stack at async Install.install (/usr/local/lib/node_modules/npm/lib/install.js:150:5) 110 verbose cwd /Users/abcde/Project/XXX/Workspace/xyz-app 111 verbose Darwin 19.6.0 112 verbose argv "/usr/local/Cellar/node/16.4.2/bin/node" "/usr/local/bin/npm" "i" 113 verbose node v16.4.2 114 verbose npm v7.20.2 115 error code EINVALIDTAGNAME 116 error Invalid tag name ">=^16.8.1": Tags may not have any characters that encodeURIComponent encodes. 117 verbose exit 1

Manikandan K
  • 117
  • 14
  • Q: Is your command line exactly `npm install` (and *NOTHING* else)? Q: Can you show us the relevant part of the log ("2021-08-02T05_31_11_609Z-debug.log"). In particular, exactly which file is NPM encountering the error on? – paulsm4 Aug 02 '21 at 06:00
  • @paulsm4 - Added error log from debug.log file – Manikandan K Aug 02 '21 at 07:42
  • 1
    Look here: https://stackoverflow.com/a/65093533/421195 and try adding this: `--legacy-peer-deps` – paulsm4 Aug 02 '21 at 15:44

1 Answers1

0

I got the solution for this issue. We can fix this issue in two ways,

  1. Downgrade the npm version(In my case, I have downgraded it to 6.14.14 after that it's working fine.)

npm install -g npm@6.14.14

  1. In the terminal, navigate to your project root directory and run this

npm install --legacy-peer-deps

Manikandan K
  • 117
  • 14