Gulp安装了错误的版本。需要3.9.1,但继续安装4.0.2

时间:2019-08-23 04:37:26

标签: docker gulp

尽管尝试了所有我知道该怎么做的事情,并且进行了大量的搜索,但我仍然无法弄清楚出了什么问题。我正在尝试在Docker中启动一个较旧的项目。 package.json文件设置为安装gulp@3.9.1,但是当Dockerbuild运行并安装软件包时,每次都会安装4.0.2。

如何获取我的Docker映像以安装正确版本的gulp?

Dockerfile

WORKDIR /var/www

#Install Node and NPM
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt update
RUN apt install -y nodejs lsof

#Install NPM deps
COPY ./package-lock.json /var/www/package-lock.json
COPY ./package.json /var/www/package.json
RUN npm install --quiet >> /dev/null \
    && npm link gulp \
    && gulp -v

package.json

"devDependencies": {
    "gulp": "^3.9.1",
}

package-lock.json

"gulp": {
  "version": "3.9.1",
  "resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz",
  "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=",
  "dev": true,
  "requires": {
    "archy": "^1.0.0",
    "chalk": "^1.0.0",
    "deprecated": "^0.0.1",
    "gulp-util": "^3.0.0",
    "interpret": "^1.0.0",
    "liftoff": "^2.1.0",
    "minimist": "^1.1.0",
    "orchestrator": "^0.3.0",
    "pretty-hrtime": "^1.0.0",
    "semver": "^4.1.0",
    "tildify": "^1.0.0",
    "v8flags": "^2.0.2",
    "vinyl-fs": "^0.3.0"
  },
  "dependencies": {
    "semver": {
      "version": "4.3.6",
      "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz",
      "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=",
      "dev": true
    }
  }
},

Docker Build输出

Step 12/20 : RUN npm install --quiet >> /dev/null     && npm link gulp     && gulp -v
 ---> Running in 8dc99b37ab8a

/usr/bin/gulp -> /usr/lib/node_modules/gulp/bin/gulp.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/gulp/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ gulp@4.0.2
added 314 packages from 217 contributors in 16.348s
/var/www/node_modules/gulp -> /usr/lib/node_modules/gulp
CLI version: 2.2.0
Local version: 4.0.2

0 个答案:

没有答案