Why does my sanity.io project keep failing at the last step? - reactjs

I am trying to start a new sanity project, it keeps on failing, this is my first time using it, I have tried it on the command prompt and in my vscode terminal, always fail at exactly here:
PS C:\Users\USER\Documents\portfolio> cd .\backend_sanity
PS C:\Users\USER\Documents\portfolio\backend_sanity> npm create sanity#latest -- --coupon javascriptmastery2022
Coupon "javascriptmastery2022" validated!
You're setting up a new project!
We'll make sure you have an account with Sanity.io. Then we'll
install an open-source JS content editor that connects to
the real-time hosted API on Sanity.io. Hang on.
Press ctrl + C at any time to quit.
Prefer web interfaces to terminals?
You can also set up best practice Sanity projects with
your favorite frontends on https://www.sanity.io/templates
Looks like you already have a Sanity-account. Sweet!
✔ Fetching existing projects
? Project name: website
Your content will be stored in a dataset that can be public or private, depending on
whether you want to query your content with or without authentication.
The default dataset configuration has a public dataset named "production".
? Use the default dataset configuration? Yes
✔ Creating dataset
? Project output path: C:\Users\USER\Documents\portfolio\backend_sanity
? Select project template Clean project with no predefined schemas
? Do you want to use TypeScript? Yes
✔ Bootstrapping files from template
✔ Resolving latest module versions
✔ Creating default project files
? Package manager to use for installing dependencies? npm
Running 'npm install --legacy-peer-deps'
npm WARN deprecated sourcemap-codec#1.4.8: Please use #jridgewell/sourcemap-codec instead
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Local\npm-cache\_logs\2023-01-01T14_05_15_828Z-debug-0.log
Error: Command failed with exit code 1 (Unknown system error -1): npm install --legacy-peer-deps
at makeError$1 (C:/Users/USER/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/#sanity/cli/lib/_chunks/cli-0bbdf4ec.js:1614:1386)
at handlePromise (C:/Users/USER/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/#sanity/cli/lib/_chunks/cli-0bbdf4ec.js:1694:959)
at async installDeclaredPackages (C:/Users/USER/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/#sanity/cli/lib/_chunks/cli-0bbdf4ec.js:1694:4672)
at async initSanity (C:/Users/USER/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/#sanity/cli/lib/_chunks/cli-0bbdf4ec.js:17019:4972)
PS C:\Users\USER\Documents\portfolio\backend_sanity>
I tried to start a sanity project, I ran the command to create and it fails at the last stage

Related

(error) AWS as backend installing amplify libraries

I am new to backend. Just starting to make a To-Do app in react and was just setting up amazon aws for backend. Using this site for reference ( https://docs.amplify.aws/start/getting-started/setup/q/integration/react#initialize-a-new-backend ).
And at the point Install Amplify libraries I got stuck while i type npm install aws-amplify #aws-amplify/ui-react in root directory it shows me error everytime.[error pic][1] I am trying for a long but did not find any solution. Pls help me in this issue !!
[1]: https://i.stack.imgur.com/hrSeJ.png Here is the error i'm getting in command prompt👇
npm ERR! Unexpected end of JSON input while parsing near '...:"^1.0.0-beta.2","#aw'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Aakash~1Bansal\AppData\Roaming\npm-cache\_logs\2021-04-09T11_41_43_000Z-debug.log
F:\Learning- tanay pratap\AWS\react-amplified>npm install aws-amplify #aws-amplify/ui-react
npm ERR! Unexpected end of JSON input while parsing near '...:"^1.0.0-beta.2","#aw'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Aakash~1Bansal\AppData\Roaming\npm-cache\_logs\2021-04-09T11_45_14_875Z-debug.log
F:\Learning- tanay pratap\AWS\react-amplified>
I was having the same issue. 1st make sure your PC is connected to internet connection. Run:
npm uninstall -g #aws-amplify/cli
npm install -g #aws-amplify/cli
If possible don't minimize the window wait till everything is properly install.
This worked for me.
Still you are facing problems then reinstall node.js and then do this.
Thank you!

how to avoid other git local repository projects be recognized as unstaged changes?

Recently I was building a very basic react projector for learning reasons and I faced with a very annoying problem described by theses logs:
npm ERR! errno 1
npm ERR! react-tutorial-guide#0.1.0 eject: `react-scripts eject`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-tutorial-guide#0.1.0 eject script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache\_logs\2021-01-09T22_43_29_500Z-debug.log
I did a quick search, spent a lot of hours I finally I found the problem.
There was some unstaged change in my projects so I should do:
git add .
git commit -am "some message"
to solve the problem, I did it and in the principle, the problem wasn't been solved. I saw more carefully my project and I could see that git local repositories outside my react projects folder was been considered as unstaged changes. So when I try to commit my project by the commands above, it failed and consequentially the problem wasn't been solved what doesn't make sense they were outside my project folder and I was inside my project folder when I executed the git commands to solve the problem.
I investigated more carefully to solve the problem, so I noted that My reacts project is inside a folder, where there is other react projects, and this React projects folder was inside the document user folder, to be more precise in this path on my os system (windows 10): C:\Users(USER_NAME)\Documents
To solve the problem I simply deleted the folder where there were local git repositories and finally I could execute the wanted task:
npm run eject
I know this solution is very bad, but it was the only one that I was able to do and it is too annoying because it will cause me future problem in the react projects where I have to execute
npm run eject
in my projects when it were needed. I'm finding a better solution and if someone could show me how to avoid this issue I would be too thankfully.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache\_logs\2021-01-09T22_43_29_500Z-debug.log
In my opinion, it is not a problem with git. The error which you got is probably because of the way that you have installed the node or npm in your system. Maybe by updating the npm would have also solved your problem.
npm install -g npm
You can also download the latest version of node.js from the official site.
There is an another way of updating the node through node version manager(nvm). Please follow the instruction for installing or updating the nvm.

npm install axios not working in my react native app?

I am new to developing react native app. I'm facing problem while installing axios using the command npm install axios in my terminal.
I have tried below code as well to install axios library:
npm install --save axios
npm i axiois --save
So what is the problem why I am not able to get dependencies in my app?
A small request also is install and i are the same in this npm command?
UPDATE
Here is the log that might help you:
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/axios failed, reason: connect ETIMEDOUT 104.16.21.35:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR!
UPDATE 2
As everyone is pointing to a network problem I have tried all the answer and commentes you have provided but nothing works, but I am able to use internet on my PC easily means device in which I am running this command.
npm install axios
on the same device I am using browser, spotify and in terminal I just installed vlc using apt-get install so there is no chance of technical issue. Thank you all for help but nothing working is there any other solution?
It is clearly related to your system's network. Try changing your network by creating a hotspot from other devices.
Its network related issue make sure u have an active internet connection while installing axiois.
Try un-installing and then install it again
npm uninstall axios
npm i axios
check you network connection
after that do system update:
1) sudo apt-get update
try running the command again.
Here according to your log it may be your internet connection problem or proxy settings problem.
Try to reconnect to the internet and make sure you have active internet connection.
If reconnecting to different internet connection still does not solve your issue try to run this command :
npm cache verify
Check your config settings: npm config list
Then you could add or change your proxy settings:
npm config set http-proxy http://your_proxy_ip:port
npm config set https-proxy http://your_proxy_ip:port
Refer
Refer
Connect to hotspot and try installing , worked for me

Why can't I deploy my project onto Github?

I've tried to deploy my app to github but it kept showing me this in the terminal :
Cloning into 'node_modules\gh-pages.cache\gwenmengue.github.io!robofriends'...
fatal: repository 'https://gwenmengue.github.io/robofriends/' not found
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! robofriends#0.1.0 deploy: gh-pages -d build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the robofriends#0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\AppData\Roaming\npm-cache_logs\2019-11-04T18_18_25_037Z-debug.log
I joined a screenshot of my package.json file by the way!: https://i.stack.imgur.com/FLTmm.jpg
Moreover when I was running the operations, I was in my project directory so I don't understand what wasn't working ?
Kindly guide me how to solve this issue. Thanks.
First, make sure you CAN push your project to github from your project folder. Your credentials, remote repo, etc need to be setup and working before the script will work.
Just in case you need help with this, see this github help page
If you are able to push your project successfully to Github from the same project folder your terminal command is in, then try building and running your commands again:
npm run build
npm run deploy
This gh-pages article on Medium might be helpful as well. Also, if you want to change any of your gh-pages variables (so you can deploy your static code to a different repository in case that's what you're trying to do), here's the project page for gh-pages.
I, for example, am deploying ONLY my static build directory to a completely different public repository in Github, while keeping my React project source files in a different private repository. Github doesn't allow you to host pages from private repositories unless you pay, so I just use two repositories :). In order to achieve this, in script area of my package.json, I added the following options to the gh-pages command in my deploy directive:
"deploy": "gh-pages -d build -r https://github.com/MyGitHubName/web.git -o web",
The -r option lets you enter a different repository url, and the -o option allows you to enter a different remote origin for deploying your code, in my case I named it "web" because that's the same name as my public repository on Github.
You can list all of your existing remotes with:
git remote -v
You would setup a different remote in your local git environment with:
git remote add YourNewRemoteName https://github.com/YOURGITHUBNAME/YOURPROJECTNAME
I apologize in advanced if this is all info you already know, but when I was having trouble deploying my project, I found all of this info useful. Cheers.

Can I develop the same reactjs app on two computers via dropbox

Im using two computers and want to sometimes develop on one computer and sometimes on another. But is it possible to develop the same react js app via two computers synching everything via dropbox so all the files stays in sync. Im getting this error when Im running npm start
sh: /Users/mycomputer/Dropbox/webb/myapp/node_modules/.bin/react-scripts: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! perottosson#0.1.0 start: `react-scripts start`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the perottosson#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
For using code in multiple computer, definitely you can use version control tool like Github/Bitbucket.
But the error you are facing is different. As you are coping the node modules also from 1 computer to another it is creating issue as it might happen that both PC has different node & npm version.
So never commit node_modules folder. It is auto create folder which will download all the dependencies when you hit npm install. So I suggest you to delete node_modules and then hit npm install and then start the project through npm start
You should look into using a source control software such as Git. You can create a free account at https://github.com and store your project on there. This allows you to modify it from any computer that has access
Please use something like git for this purpose.
You also could make a git file sync over your dropbox.

Resources