Я пытаюсь создать образ докера, содержащий мой проект Vue.js, но он терпит неудачу с приведенной ниже ошибкой, когда я пытаюсь выполнить обновление с Узел 9 до Узел 10 :
$ docker build -t frontend-image .
...
Step 10/10 : RUN npm run build
---> Running in a7b7f92e4615
> demo-vue@1.0.0 build /app
> node build/build.js
node[18]: ../src/node_file.cc:836:void node::fs::Stat(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `(argc) == (4)' failed.
1: 0x9d8da0 node::Abort() [node]
2: 0x9d8e27 [node]
3: 0x9e5652 [node]
4: 0xba3c19 [node]
5: 0xba5a07 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
6: 0x13726d9 [node]
Aborted (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! demo-vue@1.0.0 build: `node build/build.js`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the demo-vue@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-10-23T19_00_49_014Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 134
Некоторые подробности ниже ...
Макет проекта :
frontend/
-> build/
-> config/
-> src/
-> static/
-> test/
-> build.sh
-> Dockerfile
-> package.json
внешний интерфейс / файл Docker:
FROM node:10
# Works with node 9
#FROM node:9
RUN apt install curl
# make the 'app' folder the current working directory
RUN mkdir /app
WORKDIR /app
# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./
# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .
# install simple http server for serving static content and project dependencies
RUN npm install -g http-server
RUN npm install
EXPOSE 8080
# PROD build
# build app for production with minification
RUN npm run build
frontend / package.json (часть скриптов):
"scripts": {
...
"build-server": "webpack --config build/webpack.server.conf.js && node src/server.js",
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs",
"build": "node build/build.js && npm run build-server"
},
frontend / build / build.js:
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // if you are using ts-loader, setting this to true will make tyescript errors show up during build
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})
frontend / build / check-versions.js
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}
Глядя на приведенное выше сообщение об ошибке, эта часть:
> node build/build.js
, кажется, причинаоб ошибке, но следующий текст не очень помогает мне понять, почему node build/build.js
терпит неудачу.
Есть идеи?