[英]Docker Gulp based on Django Cookiecutter - node path errors
我已经使用 Gulp 安装了一个基于 Django Cookiecutter 的 Docker 项目。 运行完美。
我尝试做的第一件事是安装我的 NPM 包。 他们安装,我可以在 docker local_node 中看到它们。 但是我在运行 Docker Up 时会出现路径错误。
Cookiecutter 安装了 Bootstrap。 所以我以此为例。
这个 Gulp 代码和我添加的 NPM 在普通的 Django 项目中运行良好——所以我知道地址路径适用于 node_modules。
但是在 Docker Up 中,我遇到了错误的路径错误。
[12:14:12] Error: File not found with singular glob: /app/node_modules/tooltipster/dist/js/tooltipster.bundle.js (if this was purposeful, use `allowEmpty` option)
prelim_local_node | at Glob.<anonymous> (/app/node_modules/glob-stream/readable.js:84:17)
prelim_local_node | at Object.onceWrapper (node:events:628:26)
prelim_local_node | at Glob.emit (node:events:513:28)
prelim_local_node | at Glob.emit (node:domain:489:12)
prelim_local_node | at Glob._finish (/app/node_modules/glob/glob.js:194:8)
prelim_local_node | at done (/app/node_modules/glob/glob.js:179:14)
为什么预装的 bootstrap npm 包可以工作,而我安装的包会产生问题? 有什么特殊的方法可以为 Docker 镜像添加路径吗?
Docker 仍将运行 - 只是不使用我的包。
吞咽文件。 tooltipster 和 parsleyjs 不起作用。 代码将在第一个错误后停止处理。
// Relative paths function
function pathsConfig(appName) {
this.app = `./${pjson.name}`
const vendorsRoot = 'node_modules'
return {
bootstrapSass: `${vendorsRoot}/bootstrap/scss`,
vendorsJs: [
`${vendorsRoot}/@popperjs/core/dist/umd/popper.js`,
`${vendorsRoot}/bootstrap/dist/js/bootstrap.js`,
// neither of these will work
`${vendorsRoot}/tooltipster/dist/js/tooltipster.bundle.js`,
`${vendorsRoot}/parsleyjs/dist/parsley.js`,
],
app: this.app,
templates: `${this.app}/templates`,
css: `${this.app}/static/css`,
sass: `${this.app}/static/sass`,
fonts: `${this.app}/static/fonts`,
images: `${this.app}/static/images`,
js: `${this.app}/static/js`,
}
}
这是本地的 Cookie.yml 文件。 我相信他们的代码。
非常感谢你。 我是 docker 的新手,但对学习感到兴奋。
不知道为什么,但在绝望中我删除了所有的包图像和容器。 输入我所有的代码。 然后像新的一样建造。 工作。
如果不这样做,仍然无法添加新的 npm。 它不会确认路径。 我很高兴听到任何解决方案或指出我做错了什么。 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.