"Error: EEXIST: file already exists" when running starter command for Remix.run - npm

I've never been really familiar with the npx command but from my understanding it's just a way of executing NPM packages, which is required in the Getting started guide from Remix.run web framework.
It's really frustrating to just get stuck on the first step when I simply have to execute the npx create-remix#latest command. I get the following error:
Error: EEXIST: file already exists, mkdir 'C:\Users\Ruben'
command not found: create-remix
Not sure what happens underlying but I don't know why it's trying to create a folder in the C drive when I execute this on D:\Github\new-project
NPM/NPX version: 6.14.6

This seems to be a problem with your node/npm configuration rather then remix.run.
.npmrc file at C:\Users\Ruben
Do you have a .npmrc file? Maybe try and delete it as this answer details.
If you Google for "npx eexist file already exists", you will find several threads with the same issue and it seems to be a node/npm installation/configuration issue: 1, 2

Related

Environment variables (zsh terminal) installed through npm on MacOS 12.4 Monterey - SOLVED

Background:
Dear Stackoverflow community. I recently switched from Windows to MacOS and am at a loss how to configure environment variables. Many of the previous questions asked here are about bash instead of zsh.
Goal:
I am trying to install an npm package globally. For instance:
npm install -g vercel
or any other package, and use it in my Visual Studio Code terminal (also zsh). If I want to deploy code I have to use 'npx vercel deploy' every time. I want to be able to use "vercel deploy" but instead I get:
zsh: command not found: vercel
What I tried so far:
Installing the package in zsh and visual studio code terminals (didn't work)
Setting the path equal on both VS and terminal: export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I learned that you need to add environment variabels to a .zshrc file. I don't seem to have a zshrc file. When I do:
sudo ~/.zshrc
Password: XXXXXX
sudo: /Users/vincent/.zshrc: command not found
I am getting another error.
I read in the zsh man file that you should use $HOME/.zshrc instead. Again I am getting the same errors:
vincent#Vincents-MacBook-Air-2 ~ % $HOME/.zshrc
zsh: permission denied: /Users/vincent/.zshrc
vincent#Vincents-MacBook-Air-2 ~ % sudo $HOME/.zshrc
sudo: /Users/vincent/.zshrc: command not found
Update 1:
#slebetman Thank you for your explanation. When I open the terminal I go to home via "cd $HOME" which puts me in in the home directory. However there is no way for me to create a .zshrc file in that directory. Neither via touch or vs code. I am getting the following error: "Unable to write file '/home/.zshrc' (Unknown (FileSystemError): Error: ENOTSUP: operation not supported on socket, open '/home/.zshrc')"
Update 2:
I did manage to find the .zshrc file in visual studio code under /etc. I hope this will work. I was able to overwrite the file with Sudo and add environment variables to it.
Add this to the file .zshrc file under /etc and force overwrite it:
export vercel=/Users/vincent/.npm-global/bin/vercel
Screenshots below for those who will try in the future:
Image with .zshrc file layout
Final remarks:
I don't understand how it is so difficult to add environment variables on Mac while everything else is so easy.
I have read many different questions on stackoverflow, and I can't seem to solve it. Also since I am a newbie I am not allowed to comment on there so I post here in the hope that anyone can help me :)
Best,
Vincent
Note that when you do:
npx vercel deploy
Npm will execute vercel for you without installing it. It does that by temporarily downloading vercel. If you want to run vercel directly without using npx then simply don't use npx. Install it instead:
npm install -g vercel
The -g flag installs the module globally and if the module has a CLI it will be available globally as well (note that depending on your setup you may need admin/sudo privileges to use the -g flag). Now you can run vercel by simply typing:
vercel deploy
This works in all operating systems supported by node.js and npm. That means you can even do this in Windows. In fact I use npm to distribute my tools in a simple cross-platform way so I don't have to support multiple package managers like chocolatey (Windows), homebrew (Mac OS), deb (Debian based distros), rpm (Redhat based distros) etc. (npm does not require your software to be written in node.js - I have published packages on npm written in tcl and bash).

react-native install error using the command in Cmd

I encountered an error:
'npm' is not recognized as an internal or external command, operable
program or batch file.
I am trying to install React native using the script:
"npm install -g react-native-cli"
but it is not working,
I used the node.exe file from: "https://nodejs.org/en/download/current/" with a 64-bit Windows Binary (.zip) version, getting the message: "npm should be run outside của thay đổi node, trong bạn thiết bị thường.
(Press Control-D to exit.) "
I have read some similar questions, but I have not found my answer yet.
That's because either there's some issue with your node installation or the path is not added. Firstly check if the path is added or not(Please follow the Link it might come in handy for you). If they are alright and you are still facing the issue let me know.

create-react-app: Invalid tar header issue on create new app

For some reason, I keep getting "invalid tar" error (image below).
This script used to work in the past. But as I am about to start a new project, it fails.
Here the solution that I've tried and it not working.
Delete my node_modules folder
Reinstall Nodejs and npm
Delete npmrc file in AppData\Roaming\npm\etc\npmrc
try and update the create-react-app package using the npm .
delete test project files any if created due to previous command.
run the create-react-app command again with a proper internet connection and it should work.

Installing specific node version using NVM gives an error

I want to install node v6.10.3. but when I tried to install it gives the following error. What causes this error?
creating .\config.gypi
creating .\config.mk
bash: make: command not found
nvm: install v6.10.3 failed!
(nvm maintainer here) Could you file this on http://nvm.sh, and fill out the issue template? This kind of question is more appropriate for the repo than for SO.

html-minifier fails with "ERROR: The specified config file doesn’t exist or is unreadable"

I'm using the npm package "html-minifier" (v1.0.0) and am trying to run the command (from Linux Mint, on the command line):
html-minifier -c html-minifier.cfg -o lib/welcome.html client/welcome.html
However it fails with the error:
ERROR: The specified config file doesn’t exist or is unreadable:
/var/www/projectfolder/html-minifier.cfg
Despite the existence and readability of that file.
Why might that be happening?
I installed v0.8.0:
sudo npm install -g html-minifier#0.8.0
and then the command given in the question worked. Looks like it's a bug specific to v1.0.0. I've logged an issue against the project to get it resolved.