How do I install jest? - npm

Been trying to install jest with this command:
npm i --global jest
and get these messages:
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated request-promise-native#1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
/Users/GRW/.nvm/versions/node/v6.11.1/bin/jest -> /Users/GRW/.nvm/versions/node/v6.11.1/lib/node_modules/jest/bin/jest.js
npm WARN jsdom#16.4.0 requires a peer of canvas#^2.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN ws#7.3.1 requires a peer of bufferutil#^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws#7.3.1 requires a peer of utf-8-validate#^5.0.2 but none is installed. You must install peer dependencies yourself.
+ jest#26.4.2
updated 1 package in 32.731s
Have tried manually installing peer dependencies with:
npm i --save --global canvas#^2.5.0
npm i --save --global bufferutil#^4.0.1
npm i --save --global utf-8-validate#^5.0.2
but still am unable to install jest.
How do I install jest?
EDIT: Forget about the global install and the peer dependency warnings go away, but I still get:
-bash: jest: command not found

Since I seemed to have a prior installation of nvm that kept installations of different versions of node in different directories, I decided to start fresh.
Uninstalled and deleted jest, node, npm, and nvm.
Reinstalled node/npm, and was able to install jest and get the jest -v command to work properly.

Related

I am trying to install vue3 js

I am trying to install vue3 js. but unfortunately I am getting an error please help me how can i resolve ? thanks.
developer#developer-ThinkCentre-M93p:~$ npm install -g #vue/cli
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated #hapi/joi#15.1.1: Switch to 'npm install joi'
npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm ERR! Unexpected end of JSON input while parsing near '...8HIwwH2SLKEsPpZqiiIW8'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/developer/.npm/_logs/2021-01-27T02_11_15_446Z-debug.log
install vue-cli if you haven't yet
sudo npm install -g #vue/cli
OR update to latest
sudo npm update -g #vue/cli
then create a new project with
vue create hello-world
then select vue 3 project
Including comment from #Eazash:
You need to verify your npm cache with npm cache verify and then try installing vue-cli. If that doesn't work, try clearing the cache altogether with npm cache clean --force
could also try with sudo privileges: sudo npm cache verify and sudo npm cache clean --force

cb() never called! when installing #vue/cli

Newbie here, I am trying to install vue cli for frontend development with npm, but it is throwing an error.
Here is the output of sudo npm install -g #vue/cli
[18:00 vue]$ sudo npm install -g #vue/cli
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated #hapi/joi#15.1.1: Switch to 'npm install joi'
npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-01-18T13_06_37_662Z-debug.log
Here is a complete log
I tried with and without sudo, the same error.
My machine runs Manjaro KDE 20.2, npm version 6.14.9, node v15.4.0. I have tried:
retrying to see if it works this time
sudo npm cache verify and sudo npm cache clean --force
removing /usr/lib/node_modules
reinstalling node and npm
anything else i found on the internet
I'm stuck on this error for a few days, any help is appreciated.
It's interesting that it works without -g flag, installing to current folder, but I can't figure out how to use vue command then.
Okay, i removed that Manjaro, and grabbed the latest version of ubuntu, this solved my problem, will never install Manjaro again.

Cannot find module 'webpack-cli/bin/config-yargs', cannot find module 'webpack-cli'

I have tried nearly all solutions however nothing has worked for me. i cloned a repo from a friend and tried to run the client directory. When i try run client, i get the error:
Cannot find module 'webpack-cli/bin/config-yargs'
Cannot find module 'webpack-cli'
Once i cloned the project i did npm install (as it said in the readME) but when i tried to run the client i would run into this problem:
solutions i tried:
npm install -g vue-cli
npm install --save-dev webpack
npm install --save-dev webpack-cli
i tried 'webpack --version' it will tell me i am missing something and if i want to install it. i click yes and i get the following error:
Installing 'webpack-cli' (running 'npm install -D webpack-cli')...
npm WARN ajv-keywords#3.4.1 requires a peer of ajv#^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware#3.4.0 requires a peer of webpack#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-server#3.1.11 requires a peer of webpack#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-cli#3.3.11 requires a peer of webpack#4.x.x but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
webpack-cli#3.3.11
updated 1 package and audited 12959 packages in 13.437s
24 packages are looking for funding
run npm fund for details
found 33 vulnerabilities (22 low, 7 moderate, 4 high)
run npm audit fix to fix them, or npm audit for details
Error: Cannot find module 'webpack-cli'
UPDATE:
My colleague updated some of the dependencies by GitHub bot and i pulled the repo. That seemed to do the trick

Expo says react-native is missing

I installed expo using the facebook guide by running
npm install -g expo-cli
npm install react-navigation
expo start
However it still says
npm WARN #react-native-community/netinfo#2.0.10 requires a peer of react-native#>=0.57 <0.60 but none is installed. You must install peer dependencies yourself.
npm WARN react-google-maps#9.4.5 requires a peer of #types/googlemaps#^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-google-maps#9.4.5 requires a peer of #types/markerclustererplus#^2.1.29 but none is installed. You must install peer dependencies yourself.
npm WARN react-google-maps#9.4.5 requires a peer of #types/react#^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-reanimated#1.0.1 requires a peer of react#16.0.0-alpha.6 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-reanimated#1.0.1 requires a peer of react-native#^0.44.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-webview#5.8.1 requires a peer of react-native#>=0.57 <0.60 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
I tried to delete my node_modules folder and rerunning npm install in the directory of my project
It still says react-native not found, although running
react-native -v
in command line, shows
react-native-cli: 2.0.1
react-native: 0.60.3
Actually you have only install expo-cli not react native cli , even if your package.json has react-native it is not accessiable from your cli . so you have to install react-native-cli seperately so that you can access react-native.
npm install –g react-native-cli

#vue-cli peer dependency warn

I created project using vue-cli 3, cd into it, ran npm install and got this error:
npm WARN ajv-keywords#2.1.1 requires a peer of ajv#^5.0.0 but none is installed. You must install peer dependencies yourself.
I ran
npm install ajv
Which finished with success, but I'm still getting same warn on npm install
npm install -g npm-install-peers
try this it will add all the missing peers and remove all the error