What is the solution for Error: Cannot find module 'yargs' - yarnpkg

Did the ff commands but still getting the error
run this command from powershell with admin previlages:
npm install --global --production windows-build-tools
cmd:
npm i yargs --save
yarn add yargs

npm install --save #types/yargs
This worked for me.

Related

cannot install browser-sync on macbook

I'm using the latest macbook air laptop and trying to install browser-sync globally by this command "sudo npm install -g browser-sync" after install node.js and npm succesfully.
but after I tried this command, my terminal shows this error message again and again when I'm trying to install the package repeatly since I cannot find the browser-sync command.
could anyone help me solve this problem? thank you so much in advance!
I have tried to install this package since yesterday and really don't know how it will work. I checked the user/judy/node_modules folder and can find 3 browser-sync related folders, and tried to delete them but still failed to make the command work.
error message
(base) judy#judydeAir node_modules % sudo npm install -g browser-sync
Password:
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/browser-sync
npm ERR! dest /usr/local/lib/node_modules/.browser-sync-7ZQRhsQ1
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/usr/local/lib/node_modules/browser-sync' -> '/usr/local/lib/node_modules/.browser-sync-7ZQRhsQ1'
my path:
(base) judy#judydeAir node_modules % echo $PATH
/Users/judy/opt/anaconda3/bin:/Users/judy/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
failed to use browser-sync command:
(base) judy#judydeAir node_modules % browser-sync --version
zsh: command not found: browser-sync

how can I run "npm install && npm run dev on laravel 7?

i got this error when run command "npm install && npm run dev" on my project.
I have tried to run the command "npm install" and i get the other error.
enter image description here
You have to run:
npm install; npm run dev
The && operation in CLI only works in CMD on Windows. In Powershell you have to use a semicolon instead.
First try to update your nodejs version
npm install -g node
And then install cross-env globally
npm install --global cross-env
Finally install latest autoprefixer or 9.8.0 and run dev
npm install autoprefixer#9.8.0
npm install && run dev
The error you are getting is due to && operation in CLI, first of all, you have to install all dependencies using npm install and then you are allowed to run dev mode.
For real-time compiling you can use npm run watch instead of npm run dev.
Make sure you have installed node.js within your pc.

How can i install Serverless on a Mac?

I am running sudo npm install -g serverless.
Error:
npm WARN deprecated mkdirp#0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm ERR! Unexpected end of JSON input while parsing near '...:{"name":"#babel/pars'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/AC/.npm/_logs/2020-03-30T21_11_07_100Z-debug.log
If you are using Windows:
Open Windows Powershell as admin
npm cache clean --force: Clear cache
If you are using Linux/Mac:
sudo -i: For admin privileges
npm cache clean --force
Use this:
sudo npm install -g --unsafe-perm=true --allow-root serverless

webpack 4.1.1 -> The CLI moved into a separate package: webpack-cli. -> No git binary found in $PATH

I just ran the command npm-check-updates -a and updated webpack to 4.1.1. I got the same error as everyone else at first:
The CLI moved into a separate package: webpack-cli. Please install
'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D
However when I try to run npm install webpack-cli -D I get the following error:
npm ERR! code ENOGIT
npm ERR! No git binary found in $PATH
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.
Why does webpack require git to be installed?
If anyone else gets this error and just want to continue you can install the following program, make sure to enable windows command prompt during install.
https://git-scm.com/download/win

SASS installation with Grunt

I ran
npm install --save-dev to install dev dependencies, which finished successfully but why there is no entry shown in package.json related to this command.
I just checked that if I removed "-g" option from the command
npm install -g grunt --save-dev it works properly -
so basically removing the global option from the command it is updating the package.json correctly.

Resources