I am trying to install mean.js on my ubuntu 16.04 using the following guide. And I keep getting stuck at the grunt stage.
There were issues with building node so I install using nvm https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04#how-to-install-using-nvm
Then there were issues with bower where the process was killed. Managed to solved that by adding swap. I have the 512 MB ram settings. https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
Now my problem is grunt. I now have this error.
/opt/mean$ grunt A valid Gruntfile could not be found. Please see the getting started guide for more information on how to configure grunt: http://gruntjs.com/getting-started Fatal error: Unable to find Gruntfile.
Then when I tried
/opt/mean$ npm install npm WARN checkPermissions Missing write access to /opt/mean/node_modules/tiny-lr/node_modules npm WARN checkPermissions Missing write access to /opt/mean/node_modules/tiny-lr/node_modules/body-parser/node_modules npm WARN checkPermissions Missing write access to /opt/mean/node_modules/tiny-lr/node_modules/raw-body/node_modules npm WARN eslint-config-airbnb@6.0.2 requires a peer of eslint-plugin-react@^4.0.0 but none was installed. npm ERR! path /opt/mean/node_modules/tiny-lr/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access ‘/opt/mean/node_modules/tiny-lr/node_modules’ npm ERR! at Error (native) npm ERR! { Error: EACCES: permission denied, access ‘/opt/mean/node_modules/tiny-lr/node_modules’ npm ERR! at Error (native) npm ERR! errno: -13, npm ERR! code: ‘EACCES’, npm ERR! syscall: ‘access’, npm ERR! path: ‘/opt/mean/node_modules/tiny-lr/node_modules’ } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! A complete log of this run can be found in: npm ERR! /home/ktyc/.npm/_logs/2017-06-17T08_43_13_072Z-debug.log
This is my second droplet try.
If anyone need me to edit the question or require more information, just leave a message.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I tested a few iterations before I get to this point…
After I execute
Then commented
All the mongo error went away.
After I execute
as per https://github.com/meanjs/mean I get the Mean.js test page :)
I don’t think this is the right way though. So the problem is still not solved. There has to be a better solution.
Anyway before I commented the mongod.conf. It generated the errors below.
After I commented the mongod.conf, no more errors.
@hansen
Thanks, I will try other alternatives too. Anyway I pasted the results of the command.
@hansen I am trying to verify that my installation is alright by getting the window below. Mean successful installation Unless there is another way to verify this?
@hansen
My answers were rejected as spam. I am not sure why. I suspect I misused the link funtion here.
I created an account in pastebin with the reply I intended. I hope it works. My reply here in pastebin
@hansen Below are the users generated. I don’t know which user are connected to the Node app.
@hansen
Yeap I got excited. I ran npm start and I still got the same error.
@hansen
I will implement that security feature next time.
I did what you highlighted and I got the below after I ran npm install in the project folder. It’s only 3 warning but meanjs doesn’t seem to be running.
ktyc@Mark1:~$ cd meanjs ktyc@Mark1:~/meanjs$ ktyc@Mark1:~/meanjs$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/ch okidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@ 1.1.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”} ) npm WARN eslint-config-airbnb@6.0.2 requires a peer of eslint-plugin-react@^4.0. 0 but none was installed. ktyc@Mark1:~/meanjs$
@hansen
I created a new droplet and instead of using the previous tutorials cd /opt/mean sudo npm install
I am using npm install as per https://github.com/meanjs/mean So I am now getting errors only at the Mongo part. Do you have any idea on why this is happening?
I am using the guides here https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04 https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-mongodb-on-ubuntu-16-04
I added the administrative user for Mongo as below. myuser and mypassword are placeholder for our discussion here. I thought this would have solved the authorized issue.
use admin db.createUser( { user: “myuser”, pwd: “;mypassword”, roles: [ { role: “userAdminAnyDatabase”, db: “admin” } ] } )
$ npm start
[06:42:17] Using gulpfile ~/meanjs/gulpfile.js [06:42:17] Starting ‘default’… [06:42:17] Starting ‘env:dev’… [06:42:17] Finished ‘env:dev’ after 241 μs [06:42:17] Starting ‘copyLocalEnvConfig’… [06:42:17] Starting ‘makeUploadsDir’… [06:42:17] Finished ‘makeUploadsDir’ after 566 μs [06:42:17] Finished ‘copyLocalEnvConfig’ after 32 ms [06:42:17] Starting ‘lint’… [06:42:17] Starting ‘less’… [06:42:19] Finished ‘less’ after 1.56 s [06:42:19] Starting ‘sass’… [06:42:19] Finished ‘sass’ after 464 ms [06:42:19] Starting ‘csslint’… [06:42:20] Starting ‘eslint’… [06:42:22] Finished ‘csslint’ after 2.95 s [06:42:33] Finished ‘eslint’ after 13 s [06:42:33] Finished ‘lint’ after 15 s [06:42:33] Starting ‘nodemon’… [06:42:33] Finished ‘nodemon’ after 208 ms [06:42:33] Starting ‘watch’… [06:42:33] Finished ‘watch’ after 456 ms [06:42:33] Finished ‘default’ after 16 s [06:42:33] [nodemon] 1.11.0 [06:42:33] [nodemon] to restart at any time, enter
rs
[06:42:33] [nodemon] ignoring: /home/ktyc/meanjs/.git//* .nyc_output .sass-cac he bower_components coverage /home/ktyc/meanjs/node_modules//* [06:42:33] [nodemon] watching: modules//server/views/.html server.js config/** /.js modules//server/**/.js modules//server/config/*.js [06:42:33] [nodemon] watching extensions: js,html [06:42:33] [nodemon] startingnode --debug server.js
[06:42:33] [nodemon] child pid: 4035 Debugger listening on [::]:5858 [06:42:34] [nodemon] watching 174 filesEnvironment: development Server: http://0.0.0.0:3000 Database: mongodb://localhost/mean-dev App version: 0.5.0 MEAN.JS version: 0.5.0
Unhandled rejection MongoError: not authorized on mean-dev to execute command { listIndexes: “sessions”, cursor: {} } at Function.MongoError.create (/home/ktyc/meanjs/node_modules/mongoose/node_ modules/mongodb-core/lib/error.js:31:11) at queryCallback (/home/ktyc/meanjs/node_modules/mongoose/node_modules/mongo db-core/lib/cursor.js:212:36) From previous event: at MongoStore.setAutoRemoveAsync (/home/ktyc/meanjs/node_modules/connect-mon go/src/index.js:129:40) at MongoStore.handleNewConnectionAsync (/home/ktyc/meanjs/node_modules/conne ct-mongo/src/index.js:121:18) at MongoStore (/home/ktyc/meanjs/node_modules/connect-mongo/src/index.js:89: 26) at Object.module.exports.initSession (/home/ktyc/meanjs/config/lib/express.j s:120:12) at Object.module.exports.init (/home/ktyc/meanjs/config/lib/express.js:242:8 ) at /home/ktyc/meanjs/config/lib/app.js:25:23 at /home/ktyc/meanjs/config/lib/mongoose.js:38:15 at /home/ktyc/meanjs/node_modules/mongoose/lib/connection.js:316:19 at open (/home/ktyc/meanjs/node_modules/mongoose/lib/connection.js:682:17) at NativeConnection.Connection.onOpen (/home/ktyc/meanjs/node_modules/mongoo se/lib/connection.js:692:5) at /home/ktyc/meanjs/node_modules/mongoose/lib/connection.js:652:11 at /home/ktyc/meanjs/node_modules/mongoose/lib/drivers/node-mongodb-native/c onnection.js:71:5 at /home/ktyc/meanjs/node_modules/mongoose/node_modules/mongodb/lib/db.js:23 8:5 at Server.connectHandler (/home/ktyc/meanjs/node_modules/mongoose/node_modul es/mongodb/lib/server.js:339:7) at Server.g (events.js:292:16) at emitOne (events.js:96:13) at Server.emit (events.js:188:7) at /home/ktyc/meanjs/node_modules/mongoose/node_modules/mongodb-core/lib/top ologies/server.js:299:14 at /home/ktyc/meanjs/node_modules/mongoose/node_modules/mongodb-core/lib/con nection/pool.js:469:18 at _combinedTickCallback (internal/process/next_tick.js:73:7) at process._tickCallback (internal/process/next_tick.js:104:9)
Unhandled rejection MongoError: not authorized on mean-dev to execute command { listIndexes: “sessions”, cursor: {} } at Function.MongoError.create (/home/ktyc/meanjs/node_modules/mongoose/node_ modules/mongodb-core/lib/error.js:31:11) at queryCallback (/home/ktyc/meanjs/node_modules/mongoose/node_modules/mongo db-core/lib/cursor.js:212:36) From previous event: at MongoStore.setAutoRemoveAsync (/home/ktyc/meanjs/node_modules/connect-mon go/src/index.js:129:40) at MongoStore.handleNewConnectionAsync (/home/ktyc/meanjs/node_modules/conne ct-mongo/src/index.js:121:18) at MongoStore (/home/ktyc/meanjs/node_modules/connect-mongo/src/index.js:89: 26) at module.exports (/home/ktyc/meanjs/config/lib/socket.io.js:73:20) at Object.module.exports.configureSocketIO (/home/ktyc/meanjs/config/lib/exp ress.js:213:38) at Object.module.exports.init (/home/ktyc/meanjs/config/lib/express.js:257:1 4) at /home/ktyc/meanjs/config/lib/app.js:25:23 at /home/ktyc/meanjs/config/lib/mongoose.js:38:15 at /home/ktyc/meanjs/node_modules/mongoose/lib/connection.js:316:19 at open (/home/ktyc/meanjs/node_modules/mongoose/lib/connection.js:682:17) at NativeConnection.Connection.onOpen (/home/ktyc/meanjs/node_modules/mongoo se/lib/connection.js:692:5) at /home/ktyc/meanjs/node_modules/mongoose/lib/connection.js:652:11 at /home/ktyc/meanjs/node_modules/mongoose/lib/drivers/node-mongodb-native/c onnection.js:71:5 at /home/ktyc/meanjs/node_modules/mongoose/node_modules/mongodb/lib/db.js:23 8:5 at Server.connectHandler (/home/ktyc/meanjs/node_modules/mongoose/node_modul es/mongodb/lib/server.js:339:7) at Server.g (events.js:292:16) at emitOne (events.js:96:13) at Server.emit (events.js:188:7) at /home/ktyc/meanjs/node_modules/mongoose/node_modules/mongodb-core/lib/top ologies/server.js:299:14 at /home/ktyc/meanjs/node_modules/mongoose/node_modules/mongodb-core/lib/con nection/pool.js:469:18 at _combinedTickCallback (internal/process/next_tick.js:73:7) at process._tickCallback (internal/process/next_tick.js:104:9)
@tengyong80
You’re totally right, when you use
sudo
you don’t need to use theroot
login, but your first post didn’t usesudo
orroot
.All the errors involves some type of permissions problem, so have a look at these: https://docs.npmjs.com/getting-started/fixing-npm-permissions https://til.codes/npm-install-failed-with-cannot-run-in-wd-2/ https://stackoverflow.com/questions/18136746/npm-install-failed-with-cannot-run-in-wd
Hi @tengyong80
From looking at the error log, it looks like you don’t have permissions to the
/opt/mean
directory with the current user you’re logged in as. So either change permissions to allow that user access - or run the commands asroot
or withsudo
.