I have a SvelteKit app that I'm deploying using AWS CodePipeline.
My pipeline gets triggered on pushes to CodeCommit. But CodeBuild fails with the following error messages:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project-title@0.0.1 build: `svelte-kit build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project-title@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[Container] 2021/11/30 14:45:25 Command did not exit successfully npm run build exit status 1
I tried cloning the repository and building it in a clean environment on my PC and it builds without any errors. I cannot reproduce the problem outside of CodeBuild.
buildspec.yml
version: 0.2
phases:
install:
commands:
- echo "Entered the install phase..."
- npm install
pre_build:
commands:
- echo "Entered the pre_build phase..."
build:
commands:
- echo "Entered the build phase..."
- echo "Build started on `date`"
- npm run build
post_build:
commands:
- echo "Entered the post_build phase..."
- echo "Build completed on `date`"
artifacts:
files:
- '**/*'
name: project-title
package.json
{
"name": "project-title",
"version": "0.0.1",
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build",
"preview": "svelte-kit preview",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
},
"devDependencies": {
"@sveltejs/adapter-static": "^1.0.0-next.21",
"@sveltejs/kit": "next",
"autoprefixer": "^10.4.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-svelte3": "^3.2.1",
"prettier": "^2.4.1",
"prettier-plugin-svelte": "^2.4.0",
"svelte": "^3.42.6",
"tailwindcss": "^2.2.19"
},
"type": "module"
}
svelte.config.js
import adapter from '@sveltejs/adapter-static';
export default {
kit: {
adapter: adapter({
// default options are shown
pages: 'build',
assets: 'build',
fallback: null
})
}
};
CodeBuild project environment: