Install mysql2 package manually - Sequelize-cli db:migrate - javascript

On using the command sequelize-cli db:migrate I am getting the error:
ERROR: Please install mysql2 package manually.
I could see mysql2 in the package.json file from the very beginning though still I tried to install it again.
The problem is I ran this command before on the same project and it ran successfully but I cannot get why it's giving such error now. I have tried all the commands to install mysql2 given in a related question but nothing is working for me.

try to delete node_modules, and package-lock.json. and then install again "npm i"

Related

Unable to use typescript with expo - "It looks like you're trying to use TypeScript but don't have the required dependencies installed"

I am receiving an error while trying to use Typescript with my existing expo project.
While following the docs, I created a tsconfig.json file in the project root.
When running expo start, I am prompted to install the typescript dependencies. However, after these are successfully installed (tick message appears in console: √ Installed typescript#~4.3.5, #types/react#~17.0.21, #types/react-native#~0.67.6), I receive the following error:
It looks like you're trying to use TypeScript but don't have the required dependencies installed.
Please install #types/react by running:
yarn add --dev #types/react#~17.0.21
If you're not using TypeScript, please remove the TypeScript files from your project and delete the tsconfig.json.
error Command failed with exit code 1.
After following the instructions and running the yarn add .... command, I keep seeing the same error message.
I have tried deleting the node_modules folder and package-lock.json file to no avail. I have also tried following this answer.
Any assistance would be appreciated, thank you.
Seems to be a bug. It works if I install #types/react on the specific version that Expo requests (17.0.21).
yarn add --dev #types/react#17.0.21
Just re-install expo-cli npm install -g expo-cli.
I don't know which of the following worked, but I ran the following commands and the problem went away.
sudo npm install -g expo-cli
sudo npm install -g #types/react
sudo npm install -g #types/react-native
sudo npm install -g typescript
yarn add expo-cli
solved for me.
I had the same issue. I resolved it by :
1- delete the node_modules.
2- update expo to the latest version using npm i -g expo-cli
hope this will help someone
if you installed #types/react remove that from your dev dependencies

Error in installing openVPN module in node js

I am trying to connect Sophos VPN using nodejs. For this I am referring below link
https://github.com/luigiplr/node-openvpn
So while executing npm install node-openvpn --save command I am getting error. Can anyone please help me with this issue? Below is the screenshot of error
enter image description here
Clean your cache and try again:
npm cache clean --force
npm install node-openvpn --save

bcrypt npm install error - Error: Cannot find module node-pre-gyp\bin\node-pre-gyp

I'm on Windows 10 (version 10.0.17763 build 17763). I'm trying to install Bcrypt with Nodejs Express server using NPM. I've updated the latest Nodejs version (v12.16.3). Whether I install the latest version of Bcrypt or an earlier version, I'm always getting the same error:
I'm not sure why it's looking for node-pre-gyp\bin\node-pre-gyp in the directoy C:\Users\hazzaldo\Desktop\web-dev-udemy-course\. There's no such directory there!! This is just a folder to store my course files.
Also I'm not sure why this is happening:
-Security\store-confidential-data-web-app\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file
I've looked in other forums for such error, but no solution helped me. Some are old forums asking to install deprecated modules.
Ok, after two days of pulling my hair out, trying solutions out and not getting anywhere, I finally found a reddit post with someone having exactly the same issue as me: https://www.reddit.com/r/node/comments/gahkjl/npm_drives_me_crazy_for_months_looks_for_bin/
It's because I used the & character in my folder name. I guess for some reason it throws npm off. Removing this character from my folder name resolved it.
https://www.npmjs.com/package/node-pre-gyp
That is an NPM package, I would say install node-pre-gyp and then try to install bcrypt
node-gyp is a dependency of bcrypt
I just ran 'npm install bcrypt --save' and it worked
or install this https://www.npmjs.com/package/node-gyp
Note dependencies from package.json,
Install packages individually.
In my case, I tried adding sqlite
"dependencies": {
"sqlite3": "^5.0.2"
}
and ran npm install, which did not work.
But then, removed it ,
"dependencies": {}
and ran
npm cache clean
npm install -g node-gyp
npm install --save sqlite3
Solved the issue.

How to fix "TypeError: fsevents is not a constructor" react error

While staring React app using npm start this error occurred...
I tried below things:
remove node_module package and reinstall
use yarn instead npm
3.update fsevent library using npm
still getting this error
Note: If we create react app fresh/new yarn start will work, but we close the terminal and restart using same thing below error occurred
/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:28
return (new fsevents(path)).on('fsevent', callback).start();
^
TypeError: fsevents is not a constructor
at createFSEventsInstance (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:28:11)
at setFSEventsListener (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:82:16)
at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:252:16)
at FSWatcher. (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:386:25)
at LOOP (fs.js:1565:14)
at process._tickCallback (internal/process/next_tick.js:61:11) error Command failed with exit code 1. info Visit
https://yarnpkg.com/en/docs/cli/run for documentation about this
command.
npm audit fix --force
It worked in my case
below steps solved issue :
step 1 : removing node_module and yarn.lock
step 2 : yarn install
step 3 : yarn start
This is a well-documented issue on the react GitHub repo with a couple of options to try.
I solved my error by re-installing the fsevents npm i fsevents, which worked
I solved with
sudo npm i fsevents --unsafe-perm
The #not-a-file gave will work only you can install the fsevents successfully。
but when I do that, I receive an error with this:
Error: EACCES: permission denied, mkdir '/Users/**/node_modules/jest-haste-map/node_modules/fsents/.node-gyp'
So ,I suggest you avoid this by use something like this:
sudo npm i fsevents --unsafe-perm=true --allow-root
And I also find this error may due to node version, when I use node 12,I can not install fsevents successfully , so I use nvm to modify my node version to v11.15.0
👍 Solved it using Yarn's selective dependency resolutions
"resolutions": {
"chokidar": "^3.3.1"
},
as some packages in my dependencies are still on older chokidar versions < 3
I also had the same issue though am using MacOS the issue is kind of bug. I solved this issue by repeatedly running the commands,
sudo npm cache clean --force
sudo npm uninstall
sudo npm install
One time it did not worked but when I repeatedly cleaned the cache and after uninstalling npm, reinstalled npm, the error went off. Am using Angular 8 and this issue is common
Do these simple steps. Run the following
rm -rf node_modules/ package-lock.json
and then
npm i
This worked for me.
For me, downgrading node to v11.15.0 solved the error.
remove node_module and package-lock.json and use yarn instead of npm. This saved me hours.
I deleted the node modules package and reinstalled the node and then executed the node js commands. it worked fine for me.
I FINALLY resolved the issue. The fsevent error occurred right after I installed bootstrap from my VS code terminal. I ended up using the react-bootstrap-github stylesheet code instead and put it in my index.html!
I solved changed my "package.json" using this react-scripts": "2.1.8
I had the same issue. I run the following command and it is working fine now, without using Yarn.
"npm audit fix"
I just solved this issue in node v11.15.0 my solution was: with my "react-scripts" version in "3.0.1" I just update it to "2.1.8" and run npm install after. You can use this version or search for one that works for you. Another option is updating nodejs to the latest version, then remove modules and run npm install.
Currently, we did not found any permanent resolve, but you just create that app again or use yarn package manager to install all modules again in your react app then run yarn start. that's how I solve my issue in react app.
I was able to get it working after running:
$sudo npm install npm#latest -g
I had this issue using the ng serve command. I tried all of the above combinations and none of them seemed to fix this issue permanently. A simple quick fix / get around for me was to close and reopen the terminal.
I had this error TypeError: fsevents is not a constructor and tried all answers (remove node_modules, uninstalling/installing fsevents, sudo npm cache clean --force, sudo npm install/uninstall) listed; but nothing resolved it. For some reason, fsevents is breaking for node version >v10.x.
Regenerating lockfile resolved this issue
npm i --package-lock-only
Run this command
npm install latest-version
Run:
npm audit fix --force
Then, try again.
This often happens due to the continuous update to react and npm-packages.
Try to remove your node_modules
npm uninstall
delete your yarn.lock
this will save tons of time and if you are using npm instead if yarn
always updated.
run yarn install
After trying "npm audit fix --force" did not work , I tried:
Removing node_modules folder
npm i
worked for me

npm install --production --prefix giving an error

I went to an issue while trying to create some build steps for Node project.
Issue:
npm install --production --prefix ./.build - Gives me an error
I tried changing the name in the package.json but I still receive the same error:
The current working drectory is important to npm.
Are you sure you're in your app folder?
Please type pwd command if you're unsure...
That error is usually produced when running npm command from a wrong folder...
The problem is, that you have the project you are working on at the moment as dependency in your project - check the package.json file. Try changing the name of the project in package.json.

Categories