After npm install tachyons, tachyons package not added in package.json? - reactjs

npm install output:
npm WARN afterxii#1.0.0 No description
npm WARN afterxii#1.0.0 No repository field.
+ tachyons#4.11.1
updated 1 package and audited 518 packages in 5.404s
found 0 vulnerabilities
How can it be added in package.json

You should include the command you're executing.
However, I assume that you executed npm install. To add a package to dependencies you should do npm install --save or npm install --save-dev.
More info in the documentation https://docs.npmjs.com/cli/install

Related

npm ERR! cb.apply is not a function (Windows)

I'm having this problem when trying to install React, can anyone please help me?
C:\Users\MyName>npm install react --save
npm WARN npm npm does not support Node.js v16.13.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mikok\AppData\Roaming\npm-cache\_logs\2022-01-08T13_47_27_192Z-debug.log
Uninstall NPM and install the latest version of Node. The current version, not LTS on the website.
Go to C:\Users\UserName\AppData\Roaming and delete the "npm" and "npm cache" folders.
On your command prompt, run "npm cache clean --force".
Then run "npx create-react-app#latest your-app-name" or "npx create-next-app#latest your-app-name" depending on you preference.
npm uninstall -g npm
or
Uninstall Node from your program files.

NPX create-react-app cannot find a matching version for #typescript-eslint/experimental-utils#2.19.1

I'm on a new computer and tried to run npx create-react-app myapp and I am receiving this error. Never had this before, it looks like it's missing the es-lint package?
$ npx create-react-app my-app
npx: installed 99 in 4.157s
Creating a new React app in C:\Users\Name\Documents\demos\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ETARGET
npm ERR! notarget No matching version found for #typescript-eslint/experimental-utils#2.19.1.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of '#typescript-eslint/eslint-plugin'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Name\AppData\Roaming\npm-cache\_logs\2020-02-10T19_41_06_770Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting my-app/ from C:\Users\Name\Documents\demos
Done.
Looks like this is now a known bug in the release of typescript-eslint version 2.19.1 a couple hours ago and they're working on fixing it at the moment:
https://github.com/typescript-eslint/typescript-eslint/issues/1588
UPDATE:
This was a problem with NPM - and there were likely other builds affected.
https://status.npmjs.org/incidents/1dpd0zjyhj2v
Either way, this has been resolved.

Installing material-ui showing warning: $ npm install #material-ui/core npm WARN ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0

I am installing material-ui: npm install #material-ui/core (which is the latest version) for React.
I got the latest npm version (npm i -g npm, which is now + npm#6.1.0).
And I also have tried: npm install --save material-ui.
But it always keeps showing me this:
$ npm install #material-ui/core
npm WARN ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0 but none is installed. You must install peer dependencies yourself.
#material-ui/core#1.2.1
updated 1 package and audited 14597 packages in 8.235s
found 0 vulnerabilities.
I don't know if this is a material-ui latest version problem? or it is the latest npm problem? So, how do I proceed to install the material-ui for React?
You need to install ajv#^6.0.0
npm install -S ajv#^6.0.0
Edit: to add to this, as described in this post, it seems that npm removed the automatic installation of peer dependencies on npm 3, but if you'd like that to be taken care of automatically, you can use npm-install-peers

create-react-app - can't use npm install

I have never used react in a standalone project, always with Rails.
I wanted to create-react-app today and so I ran create-react-app myapp.
npm start and everything went smoothly until I wanted to add some npm packages, let's say flow-bin:
When I run npm install --save-dev flow-bin it says this:
npm WARN gentlyRm not removing /mypath/myapp/node_modules/espree/node_modules/.bin/acorn as it wasn't installed by /mypath/myapp/node_modules/espree/node_modules/acorn
npm notice created a lockfile as package-lock.json. You should commit this file.
+ flow-bin#0.47.0
added 1 package and removed 1096 packages in 15.55s
And when I try to run npm start there are also some errors.
Is this a bug? Why is npm install removing my packages?
Versions:
NPM - 5.0.3
Node - 7.10.0
create-react-app - 1.3.1

"Failed to parse json" error while doing "yo angular"

I am learning Angular from this tutorial and here is what I have done so far:
I installed Node v0.10.29 successfully on my 64bit Windows 7 machine. After that, while installing yeoman, I got this issue: https://github.com/yeoman/yeoman.io/issues/283
I ignored that issue assuming that its minor and installed generator-angular which was successful. I used cmd as an administrator for all this.
After that, did yo angular and here is what I got:
c:\x-news>yo angular
_-----_
| | .--------------------------.
|--(o)--| | Welcome to Yeoman, |
`---------' | ladies and gentlemen! |
( _'U`_ ) '--------------------------'
/___A___\
| ~ |
__'.___.'__
' ` |° ' Y `
Out of the box I include Bootstrap and some AngularJS recommended modules.
[?] Would you like to use Sass (with Compass)? No
[?] Would you like to include Bootstrap? Yes
[?] Which modules would you like to include?
create app\styles\main.css
create app\index.html
create bower.json
create .bowerrc
create package.json
create Gruntfile.js
invoke angular:common:C:\Users\Rahul\AppData\Roaming\npm\node_modules\gener
ator-angular\app\index.js
create .editorconfig
create .gitattributes
create .jshintrc
create .gitignore
create test\.jshintrc
create app\.buildignore
create app\.htaccess
create app\404.html
create app\favicon.ico
create app\robots.txt
create app\views\main.html
create app\images\yeoman.png
invoke angular:main:C:\Users\Rahul\AppData\Roaming\npm\node_modules\generat
or-angular\app\index.js
create app\scripts\app.js
invoke angular:controller:C:\Users\Rahul\AppData\Roaming\npm\node_modules\g
enerator-angular\app\index.js
create app\scripts\controllers\main.js
create test\spec\controllers\main.js
invoke karma:app
I'm all done. Running bower install & npm install for you to install the require
d dependencies. If this fails, try running the command yourself.
create test\karma.conf.js
create .travis.yml
npm WARN package.json xnews#0.0.0 No description
npm WARN package.json xnews#0.0.0 No repository field.
npm WARN package.json xnews#0.0.0 No README data
npm WARN package.json xnews#0.0.0 No description
npm WARN package.json xnews#0.0.0 No repository field.
npm WARN package.json xnews#0.0.0 No README data
npm WARN deprecated grunt-ngmin#0.0.3: use grunt-ng-annotate instead
npm WARN deprecated ngmin#0.4.1: use ng-annotate instead
bower cached git://github.com/angular/bower-angular-scenario.git#1.2.16
bower validate 1.2.16 against git://github.com/angular/bower-angular-scenar
io.git#1.2.16
bower cached git://github.com/angular/bower-angular.git#1.2.16
bower validate 1.2.16 against git://github.com/angular/bower-angular.git#1.
2.16
bower cached git://github.com/angular/bower-angular-mocks.git#1.2.16
bower validate 1.2.16 against git://github.com/angular/bower-angular-mocks.
git#1.2.16
bower cached git://github.com/es-shims/es5-shim.git#3.1.1
bower validate 3.1.1 against git://github.com/es-shims/es5-shim.git#~3.1.0
bower cached git://github.com/twbs/bootstrap.git#3.2.0
bower validate 3.2.0 against git://github.com/twbs/bootstrap.git#~3.2.0
bower cached git://github.com/bestiejs/json3.git#3.3.2
bower validate 3.3.2 against git://github.com/bestiejs/json3.git#~3.3.1
npm WARN optional dep failed, continuing fsevents#0.2.0
npm ERR! Failed to parse json
ERR! Unexpected string
npm ERR! File: C:\Users\Rahul\AppData\Roaming\npm-cache\send\0.1.4\package\packa
ge.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd c:\x-news
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! file C:\Users\Rahul\AppData\Roaming\npm-cache\send\0.1.4\package\packag
e.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected string
npm ERR! File: C:\Users\Rahul\AppData\Roaming\npm-cache\send\0.1.4\package\packa
ge.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "karma-phantomjs-launcher" "k
arma-jasmine" "grunt-karma" "--save-dev"
npm ERR! cwd c:\x-news
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! file C:\Users\Rahul\AppData\Roaming\npm-cache\send\0.1.4\package\packag
e.json
npm ERR! code EJSONPARSE
--
> phantomjs#1.9.7-15 install c:\x-news\node_modules\karma-phantomjs-launcher\nod
e_modules\phantomjs
> node install.js
Download already available at C:\Users\Rahul\AppData\Local\Temp\phantomjs\phanto
mjs-1.9.7-windows.zip
Extracting zip contents
Copying extracted folder C:\Users\Rahul\AppData\Local\Temp\phantomjs\phantomjs-1
.9.7-windows.zip-extract-1406128242405\phantomjs-1.9.7-windows -> c:\x-news\node
_modules\karma-phantomjs-launcher\node_modules\phantomjs\lib\phantom
Writing location.js file
Done. Phantomjs binary available at c:\x-news\node_modules\karma-phantomjs-launc
her\node_modules\phantomjs\lib\phantom\phantomjs.exe
bower cached git://github.com/jquery/jquery.git#2.1.1
bower validate 2.1.1 against git://github.com/jquery/jquery.git#>= 1.9.0
||
> ws#0.4.31 install c:\x-news\node_modules\karma\node_modules\socket.io\node_mod
ules\socket.io-client\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
/
c:\x-news\node_modules\karma\node_modules\socket.io\node_modules\socket.io-clien
t\node_modules\ws>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bi
n\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
npm WARN optional dep failed, continuing fsevents#0.2.0
bower install json3#3.3.2
bower install es5-shim#3.1.1
bower install angular-scenario#1.2.16
bower install angular-mocks#1.2.16
bower install angular#1.2.16
bower install bootstrap#3.2.0
bower install jquery#2.1.1
\-
json3#3.3.2 bower_components\json3
es5-shim#3.1.1 bower_components\es5-shim
angular-scenario#1.2.16 bower_components\angular-scenario
└── angular#1.2.16
angular-mocks#1.2.16 bower_components\angular-mocks
└── angular#1.2.16
angular#1.2.16 bower_components\angular
bootstrap#3.2.0 bower_components\bootstrap
└── jquery#2.1.1
jquery#2.1.1 bower_components\jquery
-\
> jpegtran-bin#0.2.7 postinstall c:\x-news\node_modules\grunt-contrib-imagemin\n
ode_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin
> node index.js
√ pre-build test passed successfully-
> gifsicle#0.1.6 postinstall c:\x-news\node_modules\grunt-contrib-imagemin\node_
modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle
> node index.js
√ pre-build test passed successfully
> optipng-bin#0.3.9 postinstall c:\x-news\node_modules\grunt-contrib-imagemin\no
de_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin
> node index.js
√ pre-build test passed successfully
> pngquant-bin#0.3.1 postinstall c:\x-news\node_modules\grunt-contrib-imagemin\n
ode_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin
> node index.js
√ pre-build test passed successfully
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! c:\x-news\npm-debug.log
npm ERR! not ok code 0
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! c:\x-news\npm-debug.log
npm ERR! not ok code 0
app/index.html modified.
c:\x-news>
As you can notice, the first error here is Failed to parse json. Not sure why it is failing.
As per this answer, I did bower install. Nothing was displayed. I assumed it went successful (I checked the version later).
Versions:
c:\x-news>node --version
v0.10.29
c:\x-news>bower --version
1.3.8
c:\x-news>grunt --version
grunt-cli v0.1.13
grunt v0.4.5
c:\x-news>yo --version
1.2.0
c:\x-news>npm --version
1.4.14
I tried this multiple times, starting over, still failed. What am I doing wrong here? Can anyone please point me into the right direction?
Just a tip for anyone running into this issue, the error can be the result of incorrect formatting in your package.json. The terminal error in the question says:
npm ERR! Unexpected string
npm ERR! File: C:\Users\Rahul\AppData\Roaming\npm-cache\send\0.1.4\package\packa
ge.json
So look for something similar in your terminal. It might even point to a specific line number(Note: if it does and you see nothing wrong check a line or two up because the error is often on a line before the one logged in the console error). In my case it pointed to a trailing ',' that caused the JSON parse error.
Carefully go through the package.json line by line. If you don't find anything that could be causing the problem then run npm cache clean and npm install again as suggested above. Hope that helps someone!

Resources