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

Problem setting up #335

Closed
psiddharthdesign opened this issue Mar 31, 2023 · 1 comment
Closed

Problem setting up #335

psiddharthdesign opened this issue Mar 31, 2023 · 1 comment

Comments

@psiddharthdesign
Copy link

Hey Kent ,

I'm facing few issues with setting up react fundamentals. My node, git and npm are up to date. Pasted the errors I got below :

  1. Your cache folder contains root-owned files, due to a bug in
    npm ERR! previous versions of npm which has since been addressed.

  2. [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
    npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
    npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.

  3. Failure: Dependency Installation.

@kentcdodds
Copy link
Member

That first error is the issue. Here's what ChatGPT said when I asked it how to solve this error:


This error indicates that there are files in the cache folder that are owned by the root user, which could cause permission issues when using npm.

To solve this error, you can follow these steps:

Open your terminal and navigate to the directory where the cache folder is located.

Run the following command to change the ownership of the cache folder to your current user:

sudo chown -R $(whoami) ~/.npm

This command will recursively change the ownership of all files and folders in the ~/.npm directory to your current user.

After the ownership has been changed, you can clear the npm cache by running the following command:

npm cache clean --force

This will remove all cached packages and their associated data.

Finally, you can try running the command that caused the error again to see if the issue has been resolved.
If you still encounter the same error, you may need to completely uninstall and reinstall npm to resolve the issue.


I then asked it for the windows solution in case you're on a windows machine:


Sure, here's how to solve this error on a Windows machine:

Open a command prompt or PowerShell as an administrator.

Run the following command to change the ownership of the cache folder to your user:

takeown /f "%AppData%\npm-cache" /r /d y

This command will change the ownership of the npm cache folder to your user account.

After changing the ownership, you can clear the npm cache by running the following command:

npm cache clean --force

This will remove all cached packages and their associated data.

Finally, you can try running the command that caused the error again to see if the issue has been resolved.
If you still encounter the same error, you may need to completely uninstall and reinstall npm to resolve the issue.


If that doesn't solve it, I suggest asking ChatGPT follow-up questions. In any case, it definitely seems like there's an issue on your local machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants