Trying to test compoundjs with mysql but it fails.
My system is Debian 7 with following versions of nodejs & npm
$ node -v
v0.10.13
$ npm -v
1.3.4
Here is how I installed compoundjs
sudo npm install -g compound
sudo npm install -g jugglingdb --save
sudo npm install -g jugglingdb-mysql
compound init testapp --db mysql
cd testapp
npm install
$ node server.js
WARNING: JugglingDB adapter "mysql" is not installed,
so your models would not work, to fix run:
npm install jugglingdb-mysql
/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55
if (!schema.adapter) throw new Error('Adapter is not defined');
^
Error: Adapter is not defined
at init (/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55:36)
at CompoundServer.initialize (/srv/www/playground/node/testapp/node_modules/jugglingdb/index.js:31:19)
at CompoundServer.EventEmitter.emit (events.js:98:17)
at CompoundServer.initCompound (/srv/www/playground/node/testapp/node_modules/compound/lib/compound.js:123:14)
at CompoundServer.initCompoundServer [as init] (/srv/www/playground/node/testapp/node_modules/compound/lib/server/compound.js:53:29)
at /srv/www/playground/node/testapp/node_modules/compound/lib/compound.js:67:18
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:901:3
After getting the error above I tried
npm install jugglingdb-mysql
I still get the same error. I have tried installing jugglingdb and jugglingdb-mysql globally and locally (without -g). I keep getting the same error.
The bug is due to the jugglingdb version used in the npm deposit of jugglingdb-mysql, so the only way to fix it is to delete the directory and copy the one you use in your main project :
cd $YOUR_PROJECT_ROOT
rm -rf node_modules/jugglingdb-mysql/node_modules/jugglingdb
cp -R node_modules/jugglingdb node_modules/jugglingdb-mysql/node_modules
I haven't tries to install the adapter manually from github, maybe it works too.
The problem is reported here https://github.com/jugglingdb/mysql-adapter/issues/46
Related
I am trying to install npm install -g json-server on mac OS, but it is showing error. Any recommendation. What I need to change ?
Try adding 'sudo' at the beginning.
sudo npm install -g json-server
then enter admin password to begin install.
Whenever your command is not.
Use "sudo" before code.
Ex: npm install -g json-server
Use: sudo npm install -g json-server
Sudo "forces" installation or in other words, sudo is admin.
I am installing PM2 for hubot rocket.chat adapter. so i did the following:
I firstly added a file to hubot adapter folder, then
sudo npm install pm2 -g
cd <hubot directory>
pm2 start <pm2.json>
The i got error saying this:
No command 'pm2' found, did you mean:
Command 'wm2' from package 'wm2' (universe)
Command 'pms' from package 'pms' (universe)
Command 'pmk' from package 'pmk' (universe)
Command 'pmw' from package 'pmw' (universe)
Command 'fpm2' from package 'fpm2' (universe)
Command 'pom2' from package 'libpod-pom-perl' (universe)
Command 'pmi' from package 'powermanagement-interface' (universe)
Command 'pm' from package 'powerman' (universe)
pm2: command not found
Then I tried to add the path by doing:
sudo env PATH=$PATH:/home/jy/.npm-global/bin pm2 startup -u safeuser
and
export PATH=$PATH:/home/jy/.npm-global/bin
and restarted PuTTY,
still get the same error.
when I went to where PM2 is at, which is /home/jy/.npm-global/bin, and do pm2 start <pm2.json> command, still get the same error.
Is there anything i did wrong? or there might be other reasons?
The problem is that you are running NPM as sudo, so you will only be able to access it using:
sudo pm2 start server.js
Install without sudo, you may even install without the -g flag and call it directly from node_modules directory. This may be useful if you do not have root (admin) privileges in the machine you're working on.
npm install pm2
./node_modules/.bin/pm2 start server.js
Source: https://stackoverflow.com/a/40812333/1052581
I tried installing gulp via cmd on my mac but and used
nmp install gulp-cli --global
but couldn't install, instead it throws a permission denied error as show in the image below. Any suggestions?
http://i.stack.imgur.com/dO91r.png
It's all about permission problem. You can try,
sudo npm install -g gulp-cli--global --allow-root
bower EACCES EACCES: permission denied, open '/home/caner/.cache/bower/packages/e5ec1b46386aa59c822f27e340f7ab5b-1.5.8.lock'
Stack trace:
Error: EACCES: permission denied, open '/home/caner/.cache/bower/packages/e5ec1b46386aa59c822f27e340f7ab5b-1.5.8.lock'
at Error (native)
Console trace:
Error
at StandardRenderer.error (/home/caner/.npm-global/lib/node_modules/bower/lib/renderers/StandardRenderer.js:81:37)
at Logger.<anonymous> (/home/caner/.npm-global/lib/node_modules/bower/lib/bin/bower.js:110:26)
at emitOne (events.js:90:13)
at Logger.emit (events.js:182:7)
at Logger.emit (/home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/bower-logger/lib/Logger.js:29:39)
at /home/caner/.npm-global/lib/node_modules/bower/lib/commands/index.js:48:20
at _rejected (/home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/q/q.js:844:24)
at /home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/q/q.js:870:30
at Promise.when (/home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/home/caner/.npm-global/lib/node_modules/bower/lib/node_modules/q/q.js:788:41)
System info:
Bower version: 1.7.9
Node version: 5.12.0
OS: Linux 4.4.0-38-generic x64
i got this error when i try to install bower with
bower pdate
i tried lots of things.
bower init
chown
but did not work
i first installed npm then try to install bower.
i did most of those
https://www.google.com.tr/search?q=Error%3A+EACCES%3A+permission+denied%2C+open+%27%2F%2Fbower-github.json%27&oq=Error%3A+EACCES%3A+permission+denied%2C+open+%27%2F%2Fbower-github.json%27&aqs=chrome..69i57j69i58.3505j0j4&sourceid=chrome&ie=UTF-8
but not working.
what can be reason?
what i want to do is
npm install
npm install -g bower (no need if you have installed bower)
bower install
bower prune
bower update
npm install -g gulp (no need if you have installed gulp)
gulp install
in a project directory
Remove .cache folder first, I guess that .cache folder created with different permissions, it happens when You play with sudo and etc.
So run this:
sudo rm -rf /home/caner/.cache
and after that run Your commands again
After installing node.js and sequelize.js, and running a basic test, the message "You need to install mysql package manually" is displayed.
I've tried searching the web and Stackoverflow for the cause of this message.
I have installed:
mysql server version 5.5.31-0ubuntu0.13.04.1
node v0.10.5
sequelize.js v1.6.0
You need to install the mysql npm module:
npm install mysql
The reason sequelize doesn't have the mysql module as its own dependency is because it can be used with other databases such as postgres or sqlite.
Install mysql globally:
npm install -g mysql
For 2017+ users who are using mysql2, the mysql requirement was part of Sequelize v3.
Install v4 of Sequelize (ie. npm i sequelize#4.23.0 --save) and it will work properly with mysql2.
For more info, see this issue in the github repo.
// Using NPM
$ npm install --save sequelize
# And one of the following:
$ npm install --save pg pg-hstore
$ npm install --save mysql2
$ npm install --save sqlite3
$ npm install --save tedious // MSSQL
I had tried 'npm install mysql' as it is a few times (OCD maybe), but it didn't do the trick. What actually made a difference was the answer by Svagis above:
npm install -g mysql
Now I get an access denied error, which is more of a relief because it means progress.
As a good practice, it is suggested to keep these library local to the project, so that it can be packaged and installed in other machines by npm.
i try to install package mysql and mysql2. It works!
npm install mysql2 --save
You need to install the mysql npm module.
npm install --save mysql2
I had the same issue I tried following all the steps above.
Nothing worked. Finally, found that the sequelize-cli I installed not global so it was not able to find the mysql2 module.
So I ran the following commands.
npm uninstall sequelize-cli
npm install sequelize-cli -g --force // --force removed the previous bin files
And finally, it worked :)