Have you used npm install to get mysql package?
npm i --save mysql
It is quite common to see the below error on Windows:
c:\dev\proj\js\adonis\hwblog2>npm i --save mysql
adonis-fullstack-app@4.1.0 c:\dev\proj\js\adonis\hwblog2
`-- sqlstring@2.3.1 extraneous
npm ERR! Windows_NT 10.0.17134
npm ERR! argv "C:\\dev\\js\\nodejs\\node.exe" "C:\\Users\\itsme\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "--save" "mysql"
npm ERR! node v10.11.0
npm ERR! npm v3.9.5
npm ERR! path c:\dev\proj\js\adonis\hwblog2\node_modules\.staging\bignumber.js-1aa9aeba
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'c:\dev\proj\js\adonis\hwblog2\node_modules\.staging\bignumber.js-1aa9aeba' -> 'c:\dev\proj\js\adonis\hwblog2\node_modules\bignumber.js'
npm ERR! at destStatted (C:\Users\itsme\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:154:21)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'c:\dev\proj\js\adonis\hwblog2\node_modules\.staging\bignumber.js-1aa9aeba' -> 'c:\dev\proj\js\adonis\hwblog2\node_modules\bignumber.js'
npm ERR! { Error: EPERM: operation not permitted, rename 'c:\dev\proj\js\adonis\hwblog2\node_modules\.staging\bignumber.js-1aa9aeba' -> 'c:\dev\proj\js\adonis\hwblog2\node_modules\bignumber.js'
npm ERR! at destStatted (C:\Users\itsme\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:154:21)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'c:\dev\proj\js\adonis\hwblog2\node_modules\.staging\bignumber.js-1aa9aeba' -> 'c:\dev\proj\js\adonis\hwblog2\node_modules\bignumber.js' parent: 'adonis-fullstack-app' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! c:\dev\proj\js\adonis\hwblog2\npm-debug.log
The above error is caused when trying to install mysql package for AdonisJS app, but the error itself is universal on Windows 10.
The error is caused by bignumber.js. You will see the same error when trying to install bignumber.js.
You can fix the error quite easily -
- Go to Start > Settings > Update & Security > Windows Security > Virus & threat protection > Virus & threat protection settings (or Manage Settings).
- Change
Real-time protection
toOff
. - Change
Cloud-delivered protection
toOff
.
Restart command prompt.
npm cache clean
npm i --save mysql
Works like a charm.
Don’t forget to turn the protection back after the npm install.