简体   繁体   中英

Docker Gulp based on Django Cookiecutter - node path errors

I have installed a Docker project based on Django Cookiecutter using Gulp. Runs perfectly.

First thing I try to do is install my NPM package. They install and I can see them in the docker local_node. But I will get path error when running Docker Up.

Cookiecutter comes installed Bootstrap. So I use that as an example.

This Gulp code and my added NPM works fine in a normal Django project - so I know the address paths are fine for the node_modules.

But in a Docker Up I get a bad path error.

[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)

Why do the preinstalled bootstrap npm packages work and my installed packaged create issues? Is there some special way to add a path for a Docker image?

Docker will still run - just not with my packages.

The gulpfile. tooltipster and parsleyjs do not work. The code will stop processing after the first error.

// 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`,
  }
}

Here is the local Cookie.yml file. I trust their code.

https://github.com/cookiecutter/cookiecutter-django/blob/master/%7B%7Bcookiecutter.project_slug%7D%7D/local.yml

thank you very much. I am new to docker but excited about learning.

No idea why, but in an act of desperation I deleted all the package images and container. Put in all my code. Then build like it was new. Worked.
Still can not add new npms without doing the same. It will not acknowledge the paths. I am happy to hear of any solutions or point out what I am doing wrong. Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM