Open theZulqarnain opened 2 years ago
may I have some context?
on cammand sudo docker-compose up
its show the above error.
made some changes on dockerfile like COPY ./package*.json .
package*.json
. didn't work.
any update please...
@theZulqarnain I am facing the same issue. Did you find any solution?
I have faced same issue and also found solution. Change docker-compose file and data->index.js its worked for me.
docker-compose.yml
version: '3'
services: api: # Node.js App container_name: tqd-node2 build: . ports:
./src/data:/usr/src/app/quotes
elasticsearch: # Elasticsearch Instance container_name: tqd-elasticsearch2 image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2 volumes:
volumes: # Define seperate volume for Elasticsearch data esdata:
index.js const elastic = require("../elastic"); const quotes = require("./quotes.json");
const esAction = { index: { _index: elastic.index, _type: elastic.type } }; [ { index: { _index: elastic.index, _type: elastic.type } }, { author: "quote author", quote: "quote" }
] async function populateDatabase() { const docs = []; for (const quote of quotes) { docs.push(esAction); docs.push(quote); } return elastic.esclient.bulk({ body: docs }); } populateDatabase() console.log("data inserted");
tqd-node | npm ERR! path /package.json tqd-node | npm ERR! code ENOENT tqd-node | npm ERR! errno -2 tqd-node | npm ERR! syscall open tqd-node | npm ERR! enoent ENOENT: no such file or directory, open '/package.json' tqd-node | npm ERR! enoent This is related to npm not being able to find a file. tqd-node | npm ERR! enoent tqd-node | tqd-node | npm ERR! A complete log of this run can be found in: tqd-node | npm ERR! /root/.npm/_logs/2021-11-30T15_57_13_712Z-debug.log tqd-node exited with code 254