I'm having trouble building my nuxt images in a travis CI pipeline. My local environment is ubuntu 18.04 - docker version 19.03.11 docker-compose version 1.24.1 I'm able to build and run my images locally but on the travis CI I get the following error
Step 5/7 : RUN npm run build
---> Running in d3e9433b79f0
> [email protected] build /app
> nuxt build
ℹ Production build
✔ Builder initialized
✔ Nuxt files generated
ℹ Compiling Client
ℹ Starting type checking service...
ℹ Using 1 worker with 2048MB memory limit
✔ Client: Compiled with some errors in 1.62s
Hash: 1b9cf81215d31b9f0ed3
Version: webpack 4.43.0
Time: 1624ms
Built at: 06/07/2020 2:20:27 PM
Asset Size Chunks Chunk Names
4bff68cc9fb4c003b7f2.js 1.49 KiB 1 [immutable] runtime
b4f22db01be076446c20.js 1.4 KiB 0 [immutable] app
Entrypoint app = 4bff68cc9fb4c003b7f2.js b4f22db01be076446c20.js
ERROR in ./.nuxt/client.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in /app/node_modules/@babel/helper-compilation-targets/package.json
at applyExports (internal/modules/cjs/loader.js:491:9)
at resolveExports (internal/modules/cjs/loader.js:507:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/app/node_modules/@babel/preset-env/lib/debug.js:8:33)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/app/node_modules/@babel/preset-env/lib/index.js:11:14)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
@ multi ./.nuxt/client.js app[0]
FATAL Nuxt build error
at WebpackBundler.webpackCompile (node_modules/@nuxt/webpack/dist/webpack.js:5326:21)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:5275:5)
at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:5598:5)
at async Object.run (node_modules/@nuxt/cli/dist/cli-build.js:100:7)
at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-command.js:2575:7)
My travis CI
sudo: required
dist: trusty
services:
- docker
# language: node_js
# node_js: 12
before_install:
- sudo rm /usr/local/bin/docker-compose
- sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- sudo chmod +x /usr/local/bin/docker-compose
- sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
- sudo chmod 400 -R .ops/ssh/*
# before_script:
# - my_script
script:
- .ops/build.sh
- .ops/push.sh
my docker-compose file
web:
build:
context: ${GITROOT:-.}
dockerfile: Dockerfile.web
image: moovinit_web
container_name: moovinit_web
command: npm start
environment:
WEB_PORT: ${WEB_PORT:-3200}
API_URL: ${API_URL:-http://api:3201}
<<: *node-common
Why does it build on my laptop but not on travis?
I had the similar problem. npm install @babel/helper-compilation-targets --save-dev
solved this situation