package.json 的详细原版说明之 本地路径库引用

本文档详细介绍了如何使用npm包管理器的file字段来指定本地目录作为依赖包的来源,这对于离线开发和创建不需要外部服务器的测试非常有用。通过使用相对路径或绝对路径,可以将本地目录中的包添加到项目的package.json文件中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://docs.npmjs.com/files/package.json

里面有介绍到 dep 的 file 字段。

文档里面找到更详细的介绍如下:

https://docs.npmjs.com/files/package.json#local-paths

Local Paths

s of version 2.0.0 you can provide a path to a local directory that contains a package. Local paths can be saved using npm install -S or npm install --save, using any of these forms:

../foo/bar
~/foo/bar
./foo/bar
/foo/bar

in which case they will be normalized to a relative path and added to yourpackage.json. For example:

{
  "name": "baz",
  "dependencies": {
    "bar": "file:../foo/bar"
  }
}

This feature is helpful for local offline development and creating tests that require npm installing where you don't want to hit an external server, but should not be used when publishing packages to the public registry.

 

# Use the official Ubuntu base image FROM swr.cn-central-221.ovaijisuan.com/mindformers/mindformers1.2_mindspore2.3:20240722 USER root # Set environment variables to non-interactive to avoid prompts during installation ENV DEBIAN_FRONTEND=noninteractive # Update the package list and install necessary packages RUN apt-get update && \ apt-get install -y \ software-properties-common && \ add-apt-repository -y ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y \ python3.10 \ python3.10-venv \ python3.10-distutils \ python3.10-dev \ python3-pip \ wget \ git \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Set Python 3.10 as the default python3 RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 # Create a virtual environment for MinerU RUN python3 -m venv /opt/mineru_venv # Copy the configuration file template and install magic-pdf latest RUN /bin/bash -c "wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/magic-pdf.template.json && \ cp magic-pdf.template.json /root/magic-pdf.json && \ source /opt/mineru_venv/bin/activate && \ pip3 install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple && \ pip3 install torch==2.3.1 torchvision==0.18.1 -i https://mirrors.aliyun.com/pypi/simple && \ pip3 install -U magic-pdf[full] 'numpy<2' decorator attrs absl-py cloudpickle ml-dtypes tornado einops -i https://mirrors.aliyun.com/pypi/simple && \ wget https://gitee.com/ascend/pytorch/releases/download/v6.0.rc2-pytorch2.3.1/torch_npu-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl && \ pip3 install torch_npu-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl" # Download models and update the configuration file RUN /bin/bash -c "source /opt/mineru_venv/bin/activate && \ pip3 install modelscope -i https://mirrors.aliyun.com/pypi/simple && \ wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/scripts/download_models.py -O download_models.py && \ python3 download_models.py && \ sed -i 's|cpu|npu|g' /root/magic-pdf.json" # Set the entry point to activate the virtual environment and run the command line tool ENTRYPOINT ["/bin/bash", "-c", "source /opt/mineru_venv/bin/activate && exec \"$@\"", "--"] 基于ubuntu的dockerfile 怎么改成基于centos
05-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值