Docker容器内的Grunt构建返回一个非零代码:6

时间:2023-01-16 23:40:33

I have been meeting a problem when I'm trying to build a docker container. My docker file is like

我在尝试构建docker容器时遇到了一个问题。我的docker文件就像。

FROM ubuntu:16.04
# ... RUN apt-get update && install ...

EXPOSE 3005

WORKDIR /usr/src/app
RUN npm install forever -g && \
    npm install -g bower && \
    npm install -g grunt-cli
COPY . .
RUN npm install && bower install --allow-root
RUN grunt build

WORKDIR /usr/src/app/dist
CMD NODE_ENV=${APP_ENV} forever start --uid "my_app" --append server/app.js

it will produce The command '/bin/sh -c grunt build' returned a non-zero code: 6

它将生成“/bin/sh -c咕哝构建”返回的非零代码:6

I have checked from here and speculating it might be related to ~/.known_host but I'm still working around to do the same approach. Could you please help how to fix?

我从这里查过,推测可能与~/有关。known_host,但我仍在研究如何使用相同的方法。你能帮我修一下吗?

For your information, docker stops at injector step and this was defined like below

关于您的信息,docker在注入步骤停止,如下所示

injector: {
      options: {

      },
      // Inject application script files into index.html (doesn't include bower)
      scripts: {
        options: {
          transform: function(filePath) {
            filePath = filePath.replace('/client/', '');
            filePath = filePath.replace('/.tmp/', '');
            return '<script src="' + filePath + '"></script>';
          },
          starttag: '<!-- injector:js -->',
          endtag: '<!-- endinjector -->'
        },
        files: {
          '<%= yeoman.client %>/index.html': [
              ['{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js',
               '!{.tmp,<%= yeoman.client %>}/app/app.js',
               '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.spec.js',
               '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js']
            ]
        }
      },

      // Inject component scss into app.scss
      sass: {
        options: {
          transform: function(filePath) {
            filePath = filePath.replace('/client/app/', '');
            filePath = filePath.replace('/client/components/', '');
            return '@import \'' + filePath + '\';';
          },
          starttag: '// injector',
          endtag: '// endinjector'
        },
        files: {
          '<%= yeoman.client %>/app/app.scss': [
            '<%= yeoman.client %>/{app,components}/**/*.{scss,sass}',
            '!<%= yeoman.client %>/app/app.{scss,sass}'
          ]
        }
      },

      // Inject component css into index.html
      css: {
        options: {
          transform: function(filePath) {
            filePath = filePath.replace('/client/', '');
            filePath = filePath.replace('/.tmp/', '');
            return '<link rel="stylesheet" href="' + filePath + '">';
          },
          starttag: '<!-- injector:css -->',
          endtag: '<!-- endinjector -->'
        },
        files: {
          '<%= yeoman.client %>/index.html': [
            '<%= yeoman.client %>/{app,components}/**/*.css'
          ]
        }
      }
    },

1 个解决方案

#1


0  

As you can find in the grunt,manual you have 6 status code, because you have a warning.

你可以在grunt中找到,手册中有6个状态码,因为你有一个警告。

Posiable solutions are:

Posiable解决方案是:

  1. Fix the warning.
  2. 修复的警告。
  3. grunt build => grunt build --force
  4. 咕噜建造=>咕噜建造-力量

#1


0  

As you can find in the grunt,manual you have 6 status code, because you have a warning.

你可以在grunt中找到,手册中有6个状态码,因为你有一个警告。

Posiable solutions are:

Posiable解决方案是:

  1. Fix the warning.
  2. 修复的警告。
  3. grunt build => grunt build --force
  4. 咕噜建造=>咕噜建造-力量