Problem
Im just trying to deploy serveless-cloudformation-changesets on AWS codebuild
But the build failed because of versioning error
Serverless Error ---------------------------------------
The Serverless version (1.83.3) does not satisfy the "frameworkVersion" (3) in serverless.yml
Below details
Cause
The serveless-cloudformation-changesets depends on serverless#1.83.3
https://github.com/trek10inc/serverless-cloudformation-changesets/issues/27
So executing delpoy with changesets opiton, I encounterd error
code
buildspec-changeset.yml
version: 0.2
phases:
install:
commands:
- npm install -g serverless
- npm install --save serverless-cloudformation-changesets
pre_build:
commands:
- DATE=$(date "+%Y%m%d%H%M")
- CHANGE_SET_NAME="sample_changeset_${DATE}"
build:
commands:
- sls deploy --changeset $CHANGE_SET_NAME --stage $STAGE
serverless.yml
frameworkVersion: '3'
provider:
name: aws
runtime: python3.8
stage: ${opt:stage, self:custom.defaultStage}
region: ${opt:region, self:custom.defaultRegion}
error logs
[Container] 2022/12/28 08:25:08 Entering phase INSTALL
[Container] 2022/12/28 08:25:08 Running command npm install -g serverless
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated querystring#0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated superagent#7.1.6: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731)
added 406 packages, and audited 407 packages in 19s
66 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
[Container] 2022/12/28 08:25:28 Running command serverless --version
Framework Core: 3.26.0
Plugin: 6.2.2
SDK: 4.3.2
...
[Container] 2022/12/28 08:26:07 Entering phase BUILD
[Container] 2022/12/28 08:26:07 Running command serverless --version
Running "serverless" from node_modules
Serverless: Deprecation warning: bin/serverless is deprecated, use bin/serverless.js instead
More Info: https://www.serverless.com/framework/docs/deprecations/#BIN_SERVERLESS
Framework Core: 1.83.3 (local)
Plugin: 3.8.4
SDK: 2.3.2
Components: 2.34.9
[Container] 2022/12/28 08:26:08 Running command serverless deploy --changeset $CHANGE_SET_NAME --s $STAGE --verbose
Running "serverless" from node_modules
Serverless: Deprecation warning: bin/serverless is deprecated, use bin/serverless.js instead
More Info: https://www.serverless.com/framework/docs/deprecations/#BIN_SERVERLESS
Serverless Error ---------------------------------------
The Serverless version (1.83.3) does not satisfy the "frameworkVersion" (3) in serverless.yml
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 16.15.1
Framework Version: 1.83.3 (local)
Plugin Version: 3.8.4
SDK Version: 2.3.2
Components Version: 2.34.9
Question
Is there an alternative to the serverless-cloudformation-changesets? for serverless version 3.
My Idea
If there wasnt an alternative, I will change serverless.yml with serverlessv2 or v1.
I checked the latest version of serveless-cloudformation-changesets.
But the library has not maintained since 3 years ago.
cf. https://github.com/trek10inc/serverless-cloudformation-changesets
I saw this bug in the morning and decided to fork serverless-cloudformation-changesets and update it for V3.
It's now published: https://www.npmjs.com/package/serverless-cloudformation-changesets-v3
It's a drop in replacement, you simply need to run serverless plugin install -n serverless-cloudformation-changesets-v3, and the rest should work.
This is a GitHub Action
on:
push:
branches:
- '*' # matches every branch that doesn't contain a '/'
- '*/*' # matches every branch containing a single '/'
- '**' # matches every branch
- '!master' # excludes master
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Install Node.js
uses: actions/setup-node#v1
with:
node-version: 16.x
- run: npm install
- run: gulp
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
This is the outcome from a push, which triggers it.
As you can see it works fine on Windows and Linux, but fails on OSX.
Inspecting the Run gulp step we find this message.
As you can see, gulp is not found. It's present in devDependencies, and my expectation was that the npm install step would install it, this being how it gets onto the other two platforms.
I tried explicitly installing gulp-cli but that didn't help.
Installing gulp globally (npm i gulp gulp-cli -g) resolves the problem, but I do not understand why this should be necessary for only MacOS. Perhaps the answer is one of differences between platforms but I do not like mysteries so if anyone can provide clarity that would be highly desirable.
This is the issue that I am facing when running the command npm ci to install dependencies in my GitHub Action file.
I am working on an expo managed app and using GitHub Actions as a CI for triggering builds whenever I push my code to developmemt branch.
Here's my build script:
name: EAS PIPELINE
on:
push:
branches:
- development
workflow_dispatch:
jobs:
build:
name: Install and build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout#v2
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node#v1
with:
node-version: 14.x
- name: Setup Expo
uses: expo/expo-github-action#v6
with:
expo-version: 4.x
token: ${{ secrets.EXPO_TOKEN }}
expo-cache: true
- name: Install dependencies
run: npm ci
- name: Build on EAS
run: EAS_BUILD_AUTOCOMMIT=${{1}} npx eas-cli build --platform all --non-interactive
Here's the issue that I am facing Install dependencies step.
Run npm ci
npm ci
shell: /usr/bin/bash -e {0}
env:
EXPO_TOKEN: ***
npm ERR! cipm can only install packages with an existing package-lock.json or npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm#5 or later to generate it, then try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-10-28T15_16_06_934Z-debug.log
Error: Process completed with exit code 1.
After a lot of research, I was able to figure out that this happens when you are not using npm install for installing dependencies. In my case, I was only using yarn for the dependencies so I was only having yarn.lock file and no package-lock.json file.
One way to resolve this was using npm install to install the dependencies, then you'll have a package-lock.json file and CI won't throw any error.
And the other way if you only want to use yarn, then you need to update that step in your eas-pipeline.yml file for installing the dependencies.
*****************************************************************************************
- name: Install dependencies
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
***************************************************************************************
As I wasn't able to find any solution on StackOverflow and it is our first go-to place to look for any issue. So, I decided to write this answer here.
Here's the original answer: https://github.com/facebook/docusaurus/issues/2846#issuecomment-691706184
I had a similar error.
`npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
with bunch of missing dependency name following this error.
I would run npm ci locally and it would run successfully. However, it would give me the error above when npm ci is run in the CI pipeline and in my case it was because of the version difference of the Node.js installed in the environment that Jenkins pipeline is running in.
My local Node version was 16.x and in Jenkins container it was 12.x.
Upgrading it fixed.
Old post, but I found this while searching for this same error. In my case I did have a package-lock.json file in my root directory. However, when opening it, I realized that there was a JSON syntax error that slipped in during a previous merge conflict. After running npm i again the file was fixed. The npm ERR! The 'npm ci' command can only install with an existing package-lock.json wasn't a super helpful error in that case.
This same thing happened to me, and I couldn't figure it out for the longest time. It turns out that I had legacy-peer-deps=true set globally, and I had no idea.
This caused my npm install command to alter the package-lock.json in a way that broke the build on our CI server. I reset package-lock.json with the version from master, removed that npm config, and reinstalled. Everything worked fine after that.
For the people who has this issue on AWS Amplify. You might have to run npm install and commit the package-lock.json file, then deploy again.
If you're using pnpm, you install node dependencies via this step:
- name: Install Node.js dependencies
run: |
npm i -g pnpm
pnpm i
After battling with this issue for about 2 days, It's finally deploying successfully to Firebase Functions after deleting package-lock.json from both the src and src/functions folders.
This occurred because the package lock file was not generated with npm, despite the fact that the npm ci requires npm to install the packages.
And because npm requires package-lock.json, we get this error. To fix this error for GitHub actions, this what I did:
- run: yarn install --frozen-lockfile
- run: yarn lint
- run: yarn test:ci
Commit diff:
deleting deploy.json helped me, since the token is updated when overwritten
rm ~/.config/configstore/#vkontakte/vk-miniapps-deploy.json
but I have other services
This happens sometimes because of the version difference of the Node.js installed in the environment that the pipeline is running in.
To fixe this, I ran:
$ firebase init hosting:github
then type Y to set up workflow when asked to.
finally, add "npm i" as one of the scripts to run before deploying like this:
npm i && npm ci && npm run build
I was using npm package manager and migrated to yarn package manager removing package-lock.json file.
I had this configuration in my .circleci/config.yml file
- node/install-packages
changed to
- node/install-packages:
pkg-manager: yarn
In my case the problem were some 'extraneous' packages, concretely local path dependencies. After removing them from package.json the problem was solved.
I got the error message while running npm install instead of npm ci.
On package.json I change this :
"overrides": {
"trim-newlines": "^3.0.1"
},
to : `
"overrides": {
"trim-newlines": "^1.0.0"
}
`
That Work for me successfully.
I had a similar problem deploying to heroku. I simply deleted the existing package-lock.json file and then ran
npm install
Merging the new lock file fixed the deploy.
In my case, I had this error with npm ci while using Yarn. I eventually figured out the version of Node I was using wasn't supported.
I did the following:
node -v to confirm my node version (18.0.1)
nvm use 16.13.0
Delete the node_modules directory
Delete yarn.lock
Run yarn
Run yard add + package names
After this, the error no longer occurred and the app deployed correctly.
i have trouble with gitlab Continous integration. in localhost it yarn start work without problem even unit-test yarn berry version 2.4.2
my .yarnrc.yml
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-2.4.2.cjs
how to install a specific version of yarn in gitlab with gitlab-ci.yml please ?
I tryed with this different configuration and all failed
my gitlab-ci.yml
...
unit-tests:
stage: test
image: node:15.2.1-alpine3.11
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .yarn/
script:
- yarn set version 2.4.2
/* tested also with
yarn set version https://cdn.jsdelivr.net/npm/2.4.2#1.0.0/
yarn set version 2.4.2.cjs
yarn set version https://cdn.jsdelivr.net/npm/2.4.2
*/
- yarn install
- yarn build
- yarn test
the error
00:01
Using docker image sha256:7ddc154413f500a1ec545a38fe661bf0fd138e061495e5786ef017352b52c52d for node:15.2.1-alpine3.11 with digest node#sha256:7614f96f47ede63333a7ddbd31c71207956eb39b641e724f81c198c067bacf41 ...
$ yarn set version 2.4.2.cjs
Resolving 2.4.2.cjs to a url...
error An unexpected error occurred: "Release not found: 2.4.2.cjs".
this is a solution : using yarn set version 2.4.2alone don't work
.gitlab-ci.yml
stages:
- test
- release
unit-tests:
stage: test
image: node:15.2.1-alpine3.11
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .yarn/
script:
- yarn set version berry <--- get last version
- yarn set version 2.4.2 <--- then downgrade to a specific version
- yarn install
- yarn build
- yarn test
...
Dockerfile ( for build in CI)
...
ENV NODE_ENV production
RUN yarn set version berry
RUN yarn set version 2.4.2
RUN yarn install
...
I'm trying to setup my first Bitbucket pipeline which simply builds my application and deploys it to my FTP server using the following bitbucket-pipelines.yml
image: node:6.9.4
pipelines:
default:
- step:
caches:
- node
script:
- npm install
- npm test
- step:
script:
- npm run build
- node deploy.js
The issue lies in the npm install because when bitbucket tries to run the npm run build command it says that rimraf (a npm package) is not found. rimraf however is listed in my devDependencies, all regular dependencies in my package.json are downloaded correctly.
There is no global variable set by my so the NODE_ENV could not be it right?
I had the same issue with gulp.
Gulp was in devDependencies and also specified in package.json as script but still it said npm ERR! missing script: gulp
The documentation says to install it globally, so there might be a related issue with your package.
https://confluence.atlassian.com/bitbucket/javascript-node-js-with-bitbucket-pipelines-873891287.html
I had this same issue. For me, the problem was that the version of Node on my local development device was different from the version of Node in the bitbucket-pipelines.yml file.
To fix it, I went into bitbucket-pipelines.yml and changed this line:
image: node:10.15.3
to this:
image: node:14.15.0