在macbook上安装mongo shell时出错:尝试在只读目录上创建锁定文件

时间:2017-07-31 19:24:43

标签: mongodb terminal terminate mongo-shell

我一直试图安装mongo shell两天,但我遇到了同样的错误,这个错误在任何帖子上都没有解决。已经看过很多关于此的教程,但它并不富有成效。我希望有人能让我把我带回赛道。提前致谢。

2017-08-01T00:46:18.842+0530 I CONTROL  [init and listen] MongoDB starting : pid=28050 port=27017 dbpath=/data/db 64-bit host=Salonis-MacBook-Pro-2.local
2017-08-01T00:46:18.842+0530 I CONTROL  [init and listen] db version v3.4.6
2017-08-01T00:46:18.843+0530 I CONTROL  [init and listen] git version: c55eb86ef46ee7aede3b1e2a5d184a7df4bfb5b5
2017-08-01T00:46:18.843+0530 I CONTROL  [init and listen] OpenSSL version: OpenSSL 0.9.8zh 14 Jan 2016
2017-08-01T00:46:18.843+0530 I CONTROL  [init and listen] allocator: system
2017-08-01T00:46:18.843+0530 I CONTROL  [init and listen] modules: enterprise 
2017-08-01T00:46:18.843+0530 I CONTROL  [init and listen] build environment:
2017-08-01T00:46:18.843+0530 I CONTROL  [init and listen]     distarch: x86_64
2017-08-01T00:46:18.843+0530 I CONTROL  [init and listen]     target_arch: x86_64
2017-08-01T00:46:18.843+0530 I CONTROL  [init and listen] options: {}
2017-08-01T00:46:18.867+0530 I STORAGE  [init and listen] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating
2017-08-01T00:46:18.867+0530 I NETWORK  [init and listen] shutdown: going to close listening sockets...
2017-08-01T00:46:18.867+0530 I NETWORK  [init and listen] shutdown: going to flush dialog...
2017-08-01T00:46:18.867+0530 I CONTROL  [init and listen] now exiting
2017-08-01T00:46:18.867+0530 I CONTROL  [init and listen] shutting down with code:100

1 个答案:

答案 0 :(得分:0)

只需输入Error: ERROR => Error creating test Customer: ValidationError: properties: Cast to Array failed for value "[ { name: 'Random Property 408', description: 'Description Property 408', value: 124, unit: null }, { name: 'Random Property 585', description: 'Description Property 585', value: 124, unit: null }, { name: 'Random Property 277', description: 'Description Property 277', value: true, unit: 'existance' }, { name: 'Random Property 709', description: 'Description Property 709', value: 2.345, unit: 'inches' }, { name: 'Random Property 718', description: 'Description Property 718', value: 2.345, unit: 'inches' }, { name: 'Random Property 836', description: 'Description Property 836', value: true, unit: 'existance' }, { name: 'Random Property 944', description: 'Description Property 944', value: 2.345, unit: 'inches' }, { name: 'Random Property 622', description: 'Description Property 622', value: true, unit: 'existance' }, { name: 'Random Property 757', description: 'Description Property 757', value: 'Test', unit: 'certification' }, { name: 'Random Property 508', description: 'Description Property 508', value: 124, unit: null } ]" at path "properties" at D:/DEV/v9/test/data/generatedata.js:72:10 at D:\DEV\v9\node_modules\mongoose\lib\model.js:3800:16 at D:\DEV\v9\node_modules\mongoose\lib\services\model\applyHooks.js:155:17 at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickDomainCallback (internal/process/next_tick.js:122:9) at Function.Module.runMain (module.js:606:11) at Object.<anonymous> (D:\DEV\v9\node_modules\babel-cli\lib\_babel-node.js:154:22) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3

即可

然后控制台显示$ sudo mongod

参考是https://scotch.io/tutorials/an-introduction-to-mongodb