Invalid tar header when attempting to create NextJS Project with yarn - javascript

I just wanted to create a new NextJS Project using yarn create next-app <project-name>, but at the "installing dependencies" step, yarn fails with the following error message:
error https://registry.yarnpkg.com/#next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.0.4.tgz: incorrect data check [same error with different packages] error https://registry.yarnpkg.com/next/-/next-12.0.4.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?" info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. error https://registry.yarnpkg.com/#next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-
I also get this error when normally trying to install npm packages with yarn. Apparently this seems to be some error with extracting some tar files, but I'm not sure about the exact cause of the error and how to fix it. Reinstalling yarn did unfortunately not fix the error. How can I fix this?
Edit:
Using npm doesn't work as well, and I get the following error:
npm WARN tar zlib: incorrect data check npm WARN tarball tarball data for #next/swc-darwin-x64#https://registry.npmjs.org/#next/swc-darwin-x64/-/swc-darwin-x64-12.0.4.tgz (sha512-PVgefMWjxP6CU1HQs39+Bfpjcue6qErJfvJ/+n2zimjLzyeQAmD6LM9f1lDSttW2LjKjasoxR5qkRNLVlqzlaA==) seems to be corrupted. Trying again. npm ERR! code Z_DATA_ERROR npm ERR! errno -3 npm ERR! zlib: incorrect data check

Related

vue create with e2e showing strange error

I tried creating project using vue create but I get following error all the time
✨ Creating project in C:\Users\....
⚙️ Installing CLI plugins. This might take a while...
npm ERR! Unexpected end of JSON input while parsing near '..."^5.8.23","babel-tape'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HariC\AppData\Roaming\npm-cache\_logs\2020-08-01T13_14_04_441Z-debug.log
ERROR command failed: npm install --loglevel error
I have chosen everything in except typescript support and es-lint while creating the app.
What could be the reason?
Try clearing the cache:
npm cache clean --force
Probably the error was due to corrupt cache. Referred to - https://stackoverflow.com/a/47896884/9640177
npm cache clean --force

problem while deploying react application to github

I created a todolist that is working properly in localhost.
Iam trying to deploy it on github, when I run '$ npm run deploy' in command propmt it showing error p
Added homepage, predeploy, deploy properties to package.json
installed gh-pages --save-dev
Please help I am a beginner
This is the command prompt error.
C:\Users\Syed\Desktop\project\todolist>npm run deploy
> todolist#0.1.0 predeploy C:\Users\Syed\Desktop\project\todolist
> npm run build
> todolist#0.1.0 build C:\Users\Syed\Desktop\project\todolist
> react-scripts build
Creating an optimized production build...
Compiled with warnings.
./src/App.js
Line 2:8: 'logo' is defined but never used no-unused-vars
Line 52:20: Expected to return a value in arrow function array-callback-return
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
File sizes after gzip:
55.54 KB build\static\js\2.0512a152.chunk.js
1.19 KB build\static\js\main.1e3fd05a.chunk.js
785 B build\static\js\runtime-main.ce724f51.js
657 B build\static\css\main.362672fb.chunk.css
The project was built assuming it is hosted at /To-Do-List/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
Find out more about deployment here:
bit.ly/CRA-deploy
> todolist#0.1.0 deploy C:\Users\Syed\Desktop\project\todolist
> gh-pages -d build
fatal: A branch named 'gh-pages' already exists.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! todolist#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the todolist#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\Syed\AppData\Roaming\npm-cache\_logs\2020-07-02T01_49_57_997Z-debug.log
Please check this quickstart guide
You will need to set up the GitHub pages homepage link on your GitHub repository settings page first.
Then check the source as well.
Then save. That should work.
To solve the issue with
fatal: A branch named 'gh-pages' already exists.
remove the 'gh-pages/' folder at node_modeules/.cache/
This worked for me
I am not professional in react and these tools.
But error log states that you already have a branch named "gh-pages" check your github repository and delete it.
You would find this if you've searched a little bit.
Delete node_modules/gh-pages/.cache and try again.
Linux / macOS / Git bash: rm -rf node_modules/gh-pages/.cache

error: this is probably not a problem with npm. This is likely additonal logging output above

C:\Users\Jorge\Desktop\space-xplorer>npm install
node-sass#4.11.0 install C:\Users\Jorge\Desktop\space-xplorer\node_modules\node-sass
node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node":
HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.11.0 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.11.0 postinstall 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\Jorge\AppData\Roaming\npm-cache_logs\2020-01-23T22_44_17_513Z-debug.log
This issue is coming because of compatibility issue of node version and node sass version.
You need to downgrade node version to 10 to install node sass 4.1.0. It is not compatible with version 12 of node.
See this discussion for the same issue.
Compatible versions are listed on the readme https://github.com/sass/node-sass#supported-nodejs-versions-vary-by-release-please-consult-the-releases-page-below-is-a-quick-guide-for-minimium-support
Following 2 lines of code will resolve this error
npm run build
npm start
you should ask a question and provide some explanation, not just throw an error up and expect an answer. But I've seen this before:
Basically NPM is trying lacking a dependency for loading node-sass, and its fallback is to get the file it needs from github.
Looks like you're behind a firewall that blocks you from direct access to github, but all you actually need is that file bindings file.
You would have to have a proxy server that is allowed to access github, or download the binary file yourself.
I downgraded the node from 14.8 to 12.18.3, but it did NOT solve the problem.
but after that, as crazy as it is may sound, I deleted the package-lock.json and tried to install the package again and solved the problem.

I get an error when trying to create a React app

I just want to create a new React app with:
npx start-react-app my_new_app
But I get this error:
npm ERR! code E404
npm ERR! 404 Not Found: crate-react-app#latest
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/hugovillalobos/.npm/_logs/2018-12-17T21_01_13_727Z-debug.log
Install for crate-react-app#latest failed with code 1
I attempted to do it with sudo privileges, but I just got the same error.
EDIT
I found that the error rises because I created the React app and then removed the whole directory in order to start over. Now, when I try to use the same directory name in the same parent directory, I get this error. When I use another directory, everything works with no problem.
I guess there should be some global React configurations that must be cleared besides just erasing the directory.
You can try to follow steps here https://www.valentinog.com/blog/react-webpack-babel/ It should work.
npm i react react-dom --save-dev

Cannot find plugin "karma-ng-scenerio"

I am following along in a video tutorial "Learning AngularJS" by Jack Herrington that I purchased from packtpub.com.
I'm trying to demonstrate end-to-end testing after having run my first unit test with angular.
As per the instructions, I have added the following to the karma-e2e.conf.js:
plugins: [
'karma-chrome-launcher',
'karma-ng-scenerio'
],
When I type grunt test:e2e I get the following:
Running "karma:e2e" (karma) task
WARN [config]: urlRoot normalized to "/_karma_/"
WARN [plugin]: Cannot find plugin "karma-ng-scenerio".
Did you forget to install it ?
npm install karma-ng-scenerio --save-dev
Warning: No provider for "framework:ng-scenario"! (Resolving: framework:ng-cenario) Use --force to continue.
Aborted due to warnings.
Ok, no problem: I type
npm install karma-ng-scenerio --save-dev
Now I get this:
npm ERR! 404 404 Not Found: karma-ng-scenerio
npm ERR! 404
npm ERR! 404 'karma-ng-scenerio' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 It was specified as a dependency of 'testdemo'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.
So I download the zip for karma-ng-scenario and issue this command and it looks like the problem is fixed!
npm install karma-ng-scenario-master\karma-ng-scenario-master --save-dev
karma-ng-scenario#0.1.0 node_modules\karma-ng-scenario
But now I type the command again and the same results
grunt test:e2e
and I get the same results!
Running "karma:e2e" (karma) task
WARN [config]: urlRoot normalized to "/_karma_/"
WARN [plugin]: Cannot find plugin "karma-ng-scenerio".
Did you forget to install it ?
npm install karma-ng-scenerio --save-dev
Warning: No provider for "framework:ng-scenario"! (Resolving: framework:ng-scenario) Use --force to continue.
What am I doing wrong?
I did some searching and found that ng-scenerio has been deprecated but should still work...
When I looked at the example at
http://angular.github.io/protractor/#/ it did not appear to using nodejs or grunt and I found this confusing if indeed protractor is supposed to be a substitute for ng-scenerio.
Looks like a simple typo: you have karma-ng-scenerio (note, scenerio instead of scenario) in your karma-e2e.conf. That is also why your first installation attempts failed. Fix that, and I believe everything regarding this should work.

Categories