Corrupt dependencies when installing npm inside a docker container

I create and run the following docker-composefile

gulp:
  image: node:4.4
  volumes:
    - ./admin:/node
  working_dir: /node
  command: bash -c "npm install && npm install -g gulp-cli && gulp dev"

npm installThe commands go fine, but then gulpfail with the following error:

admin-gulp_1 | npm info ok 
admin-gulp_1 | /node/node_modules/gulp-eslint/node_modules/eslint/lib/util/source-code.js:88
admin-gulp_1 | SourceCode.splitLines = function(text) {
admin-gulp_1 | ^
admin-gulp_1 | 
admin-gulp_1 | ReferenceError: SourceCode is not defined
admin-gulp_1 |     at Object.<anonymous> (/node/node_modules/gulp-eslint/node_modules/eslint/lib/util/source-code.js:88:1)
admin-gulp_1 |     at Module._compile (module.js:409:26)
admin-gulp_1 |     at Object.Module._extensions..js (module.js:416:10)
admin-gulp_1 |     at Module.load (module.js:343:32)
admin-gulp_1 |     at Function.Module._load (module.js:300:12)
admin-gulp_1 |     at Module.require (module.js:353:17)
admin-gulp_1 |     at require (internal/module.js:12:17)
admin-gulp_1 |     at Object.<anonymous> (/node/node_modules/gulp-eslint/node_modules/eslint/lib/eslint.js:21:18)
admin-gulp_1 |     at Module._compile (module.js:409:26)
admin-gulp_1 |     at Object.Module._extensions..js (module.js:416:10)
sf_admin-gulp_1 exited with code 1

When I cat /node/node_modules/gulp-eslint/node_modules/eslint/lib/util/source-code.jssee some weird characters:

/**
 * Check to see if its a ES6 export declaration
 * @param {ASTNode} astNode - qa    B0         7 sa     B0         7 sa     B0         7 va     B0         7|a      B0   L0  
   $1y   = s0  1A $1    = s0  1A $1    = L0   ,    =   = s0  1A $1!   = B0   ޳ 7 za  ೙7 a  I\ î31A $11A $1 B $1 B $11s0  1A $11A $11s0  1A $11A $1!q0  1A $1I   =p  g ) node_modules/gulp-plumber/node_modules/gulp-util/node_modules/dateformat/node_modules/meow/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/graceful-fs$1  g ) node_modules/gulp-plumber/node_modules/gulp-util/node_modules/dateformat/node_modules/meow/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-filest:2iC0  @1A $11s0  1A $11A $1!q0  1A $1    =iC0   y%hc 3 @rU11]0  1A $1Y dZ4ٞ0  1A $11A $1 S  yA $1   v<rCommentAfter = tokensAndCommentsStore.getTokenAfter;

    // don't allow modification of this object
    Object.freeze(this);
    Object.freeze(this.lines);
}

/**
 * Split the source code into multiple lines based on the line delimiters
 * @param {string} text Source code as a string
 * @returns {string[]} Array of source code lines
 * @public
 */
SourceCode.splitLines = function(text) {
    return text.split(/\r\n|\r|\n|\u2028|\u2029/g);
};

If I repeat this process, the error does not always occur in one file, but it always concerns the wrong characters in any of the files npm. If I then ran bash in the container and individually npm installspecific modules whose files are damaged, then they are committed, and gulp- successfully. If instead I run npm installand gulpin the host machine, everything works fine. What am I doing wrong?

+4
1

locale. .

FROM ubuntu:lastest

RUN locale-gen en_US.UTF-8  
ENV LANG en_US.UTF-8  
ENV LANGUAGE en_US:en  
ENV LC_ALL en_US.UTF-8

+2

All Articles