npm ERR! tb.match is not a function - node.js

I am having an issue installing csvtojson. When I run npm install csvtojson I'm getting npm error tb.match is not a function. How do I solve this?

If you cant get to use NPM right away, try to use YARN and see if the dependencies will install

Removing the lock file AND the node_modules folder worked for me. Try to remove them and run again npm install.

Remove package.lock and run npm install is working for me.

Related

npm i not working? npm ERR! Unexpected token '.'

My npm install seems to have stopped working out of nowhere, regardless of if i do npm i or npm install I keep getting an error saying npm ERR! Unexpected token '.' The other npm commands seem to be working perfectly but I can't install any modules because of this error. I'm using npm 8.7.0 and node v14.18.1
The simplest solution I could find and what worked for me was completely removing and unisntalling everything to do with nodejs and npm from my laptop. I then reinstalled it back with no issues and am able to use the command now.
As mentioned in one of the answers, try deleting the node_modules folder and package.lock.json. Use
sudo npm install
And if that doesn't work, what I would suggest is that you use yarn. If you don't know what yarn is, it's just a package manager like node.
You can install yarn by using the following command:
npm install -g yarn
After this make sure all the node modules and package.lock.json is deleted. Now run the command
yarn install
Hopefully, this will fix your issue.

npm ERR! must provide string spec

I'm having this error since a while, in this case, the problem occur executing the following command.
npx create-react-app my-app
Actually, it happens with any npm commands as well, I tried deleting package.json, changing npm versions and yet didn't work, so I'm here asking for help.
This is the entire error:
C:\Users\c>npm install
npm ERR! must provide string spec
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\c\AppData\Local\npm-cache\_logs\2022-01-28T16_50_23_009Z-debug.log
Version of npm and node:
node --version
v16.13.2
npm --version
8.3.2
I had the same issue, it was a missing version in my package.json
look like mistakenly I removed some text
"dependencies":{
"angular/cli" :"{}"
}
try to update your npm: npm upgrade
then: npm clean cache
Following, i'm in the exact same position. Tried changing the NodeJS version using NVM and now some of the commands work (npm -v shows im running 8.1.0) but npm update and npm/npx create-react-app give me an " ERR! must provide string spec " !
I faced this same issue yesterday.
This is what I did to resolve it:
Uninstalling node entirely and removing node_modules and package.lock.json from the project directory.
Install node afresh and run npm install in your project directory.
I tried to reactivate an old project which had packages noted down differently then usual in package.json. They had an id and locator parameter, like:
"ImagePicker": {
"id": "ImagePicker",
"locator": "https://github.com/dhavalsoni2001/ImagePicker.git"
}
After removing / replacing them by version numbes, i could install.

npm ERR! Cannot read properties of null (reading 'pickAlgorithm')

iam getting below error with npm while creating react app
npm ERR! Cannot read properties of null (reading 'pickAlgorithm')
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Nagamanickam\AppData\Local\npm-cache_logs\2021-11-18T12_01_45_525Z-debug.log
my npm version is 8.1.4 and i solve this problem by running :
npm cache clear --force
I resolved it by deleting node_modules and package-lock.json and run npm install again.
solved with npm i --legacy-peer-deps on react-native version .70
Just run these 2 commands :
npm cache clear --force
npm install
Probably it's a project that works with Yarn and not NPM.
Try Yarn instead of NPM.
yarn install
and then you can do
yarn start
or
npm start
Your dependency tree may be broken (due to incompartible peer dependencies) you can try running npm install with --legacy-peer-deps or --force to bypass this issue for the mean time.
I was getting this error from an old branch that had a previous version of node/npm. using the correct version of node helped in my case.
In my case the file .npmrc was corrupt. After deleting it everything worked.
I was getting the same error, but I was able to resolve it by the below described method:
Go to folder -> Local > npm-cache and delete all contents of the npm-cache.
try again with npm command, it should work now.
I solved this by update npm from 6.x to 8.5x, then run npm cache clear --force, npm install, however, it has to change the nodejs from 14 to 17, my env is macOS m1 pro.
In my case i updated npm via:
npm update -g npm
After it, everything worked fine.
Don't know why, i didn't expect it.
I solved deleting node_modules and running this command:
npm cache clear --force

npm ERR! Tracker "idealTree:inflate:" already exists

Every time I try to install packages using npm install, I'm getting npm ERR! Tracker "idealTree:inflate:" already exists error.
I've tried removing node_modules and clearing cache, but no luck for me.
I had the same issue when trying to update a v1 lockfile to v2 with npmv7, as it seems to be the case in your codebase, and the only way to make it work was to delete the lockfile, clear the cache and do a npm i again with the --prefer-dedupe flag.
With the package-lock rebuilt, npm i with no flag worked again, as did npm ci.
Before that, I tried npm i --legacy-peer-deps as it seemed to mimic npm v6 not installing peer dependencies and it failed too, however I think it's interesting to know this flag exists, check out the npm 7 announcement page for more clues : https://github.blog/2021-02-02-npm-7-is-now-generally-available/#peer-dependencies
TLDR
rm package-lock.json
npm cache clear --force
npm i --prefer-dedupe
npm update && npm i works for me.
Source: https://github.com/npm/arborist/issues/330#issuecomment-947803995
What worked for me was:
Remove package-lock.json and node_modules on the project root.
npm cache clear --force
npm install --legacy-peer-deps
Note: I need to install the dependencies with the flag because of the nature of the project, but it should work just by normally reinstalling the deps with npm install.
This error occurs in node v14, I upgrade to node v16.17.0 fix it
This might help others:
In my case I had a very small web app. Just a 'app.js' and a 'readme.md'. No 'package.json'. When deploying (using Azure Deployment Center) it returned with error 'Tracker "idealTree:inflate:" already exists'.
When I committed a 'package.json' file the deployment succeeded.

npm ERR! Cannot find module 'through2'

Whenever i do anything node relates whether it be npm install, starting a .js script or even installing modules i get this error:
'npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'through2'
i tried deleting node and reinstalling but still get it.
it randomly happened to, it seemed like out of the blue. any help would be great as this is a constant problem in my work.
If you delete your node_modules folder and try npm i it should work.
Also, if you are using gulp I think you can find your answer here cannot find module through2 while installing gulp
whatever module is missing, try using
npm install <module-name>#latest
even if this doesn't work there is another manage packager as npm known as yarn.
Try using it. Then by yarn it will be
yarn add <module-name>
it worked for me hope it works for you.

Resources