我正在尝试在Docker中运行一个节点映像,但是遇到了这个错误:
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#2 No description
npm WARN !invalid#2 No repository field.
npm WARN !invalid#2 No README data
npm WARN !invalid#2 No license field.
这是我的Docker文件。我想将所有项目文件放在容器中的/home/app/文件夹中:
# Use an official node runtime as a parent image
FROM node:10
# Set the working directory to /home/app
#WORKDIR /home/app/
# Bundle app source
COPY . /home/app/
# If you are building your code for production
# RUN npm install --only=production
RUN npm install
# Make port 8000 available to the world outside this container
EXPOSE 8000
CMD npm run dev
我在使用Windows,同时使用Hyper-V。我的package.json与Dockerfile位于同一级别。
有想法吗?
谢谢