Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: spawn Unknown system error -8 #202

Closed
Keda87 opened this issue Jul 14, 2019 · 5 comments
Closed

Error: spawn Unknown system error -8 #202

Keda87 opened this issue Jul 14, 2019 · 5 comments

Comments

@Keda87
Copy link

Keda87 commented Jul 14, 2019

I'm setup test using mocha and chai using this package and failed to run test.
I got this following error and got no clue regarding the error.


  0 passing (115ms)
  1 failing

  1) POST /tasks
       "before all" hook for "OK, Create new task is success":
     Error: spawn Unknown system error -8
      at ChildProcess.spawn (internal/child_process.js:358:11)
      at Object.spawn (child_process.js:538:9)
      at Object.spawn [as default] (node_modules/cross-spawn/index.js:12:24)
      at MongoInstance._launchMongod (node_modules/mongodb-memory-server-core/lib/util/MongoInstance.js:198:49)
      at MongoInstance.<anonymous> (node_modules/mongodb-memory-server-core/lib/util/MongoInstance.js:134:50)
      at step (node_modules/mongodb-memory-server-core/lib/util/MongoInstance.js:43:23)
      at Object.next (node_modules/mongodb-memory-server-core/lib/util/MongoInstance.js:24:53)
      at fulfilled (node_modules/mongodb-memory-server-core/lib/util/MongoInstance.js:15:58)



error Command failed with exit code 1.

The test is running within docker container using node:10.14.2-alpine

Here is my mock connection when testing my project

/* eslint-disable no-undef */
import mongoose from 'mongoose'
import { MongoMemoryServer } from 'mongodb-memory-server';

const MONGO_USER = process.env.TODO_DB_USER
const MONGO_PASS = process.env.TODO_DB_PASS
const MONGO_PORT = process.env.MONGO_PORT
const MONGO_DB_NAME = process.env.TODO_DB_NAME
const DB_URI = `mongodb://${MONGO_USER}:${MONGO_PASS}@db:${MONGO_PORT}/${MONGO_DB_NAME}`


mongoose.Promise = Promise;

export function connect() {
  return new Promise((resolve, reject) => {

    if (process.env.NODE_ENV === 'test') {
      const mongoServer = new MongoMemoryServer({ debug: true })
      mongoServer.getConnectionString()
        .then((mongoUri) => {
          mongoose.connect(mongoUri, { useNewUrlParser: true })
            .then((res, err) => {
              if (err) { return reject(err) }
              resolve()
            })
        })
        .catch(err => reject(err))
    } else {
      mongoose.connect(DB_URI, { useNewUrlParser: true })
        .then((res, err) => {
          if (err) { return reject(err) }
          resolve()
        })
        .catch(err => reject(err))
    }

  })
}

export function close() {
  return mongoose.disconnect()
}

Also here is my test command
NODE_ENV=test mocha dist/tests --recursive --exit

@nodkz
Copy link
Collaborator

nodkz commented Jul 15, 2019

Mongo does not have binaries for Linux Alpine in its download center.

You may provide MONGOMS_SYSTEM_BINARY env variable:
https://github.com/nodkz/mongodb-memory-server#docker-alpine

As a ready solution you may use:
#32 (comment)

@Keda87
Copy link
Author

Keda87 commented Jul 15, 2019

I missed that. thanks!

@Keda87 Keda87 closed this as completed Jul 15, 2019
@ntqtuan
Copy link

ntqtuan commented Jul 5, 2021

Hi, I have a project laravel + vuejs in macos. I got this error, run the command npm run dev.

[webpack-cli] Error: spawn Unknown system error -86
at ChildProcess.spawn (node:internal/child_process:415:11)
at spawn (node:child_process:698:9)
at Object.execFile (node:child_process:325:17)
at Object.module.exports.fileCommandJson (/Users/panda/Sites/blog/node_modules/node-notifier/lib/utils.js:88:13)
at NotificationCenter.notifyRaw (/Users/panda/Sites/blog/node_modules/node-notifier/notifiers/notificationcenter.js:81:11)
at WebpackNotifierPlugin.compilationDone (/Users/panda/Sites/blog/node_modules/webpack-notifier/index.js:129:14)
at _next1 (eval at create (/Users/panda/Sites/blog/node_modules/tapable/lib/HookCodeFactory.js:33:10), :39:1)
at eval (eval at create (/Users/panda/Sites/blog/node_modules/tapable/lib/HookCodeFactory.js:33:10), :63:1) {
errno: -86,
code: 'Unknown system error -86',
syscall: 'spawn'
}

please, help me

@hasezoey
Copy link
Member

hasezoey commented Jul 5, 2021

@ntqtuan please open an new issue, providing all information that would be needed (including the code that seems to error)

@ntqtuan
Copy link

ntqtuan commented Jul 5, 2021

oke thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants