[FIXED] @tanstack/react-table npm install

Issue

I want to try basic project from tanstack/react-table from
https://github.com/TanStack/table/tree/main/examples/react/basic

I am new in NPM. I am on Windows.

I wrote:

git clone https://github.com/TanStack/table.git

then I am going to the subfolder examples\react\basic

then I wrote:

npm install 

and in subfolder "node_modules" only folders "react" and "react-dom" appeard.

There is package.json:

{
  "name": "tanstack-table-example-basic",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "serve": "vite preview",
    "start": "vite"
  },
  "dependencies": {
    "@tanstack/react-table": "^8.2.6",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@rollup/plugin-replace": "^4.0.0",
    "@vitejs/plugin-react": "^1.1.3",
    "vite": "^2.8.6"
  }
}

Please, why the "@tanstack/react-table" package is not installed?

When I wrote:

npm start

I received message:

[ERROR] [plugin vite:dep-scan] Failed to resolve entry for package "@tanstack/react-table".

I tried to write:

npm install @tanstack/react-table -g

and folder "@tanstack/react-table" appeard in folder C:\Users…\AppData\Roaming\npm\node_modules. I copied it to project folder and start project and all was OK. But I think, it is not right way.

What am I doing bad, please?

Solution

do you want to add react-table to your own project or you just want to clone their project and run the samples ?
for the first one you should go to your project folder and write this in cmd
npm install @tanstack/react-table

for the second one you should clone their project then go to example folder
then write npm install in cmd

Edit 1

  1. remove all the node_modules in any folder of project
  2. run this command in main folder yarn install
  3. run yarn install in folder examples/react/basic
  4. run command npm start in basic folder

before start you should install yarn if you didn’t have it

Answered By – Reza Faghani

Answer Checked By – Robin (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published