CI/CD fails with error Cannot read property *package json property* of undefined #11773
Replies: 4 comments 1 reply
-
I'm also getting this problem. Did you find a solution? |
Beta Was this translation helpful? Give feedback.
-
Same for me, any solution? |
Beta Was this translation helpful? Give feedback.
-
@NarHakobyan @robertsamarji |
Beta Was this translation helpful? Give feedback.
-
Strange. My issue was I was using Node 18. Serverless support told me that their CI/CD feature doesn't yet support Node 18, but are currently working on it - should be ready in a few weeks. Downgrading to Node 16 solved it for me. |
Beta Was this translation helpful? Give feedback.
-
I'm having an issue with the CI/CD deployments. Everything was working fine until the other day when I started getting errors during the build step. It seems that whatever the first package in the package.json dependencies will come back as "Cannot read property package of undefined."
`build step: npm ci --if-present --unsafe-perm
npm ERR! Cannot read property '@aws-sdk/credential-provider-node' of undefined`
I can deploy through the command line on my computer and it works just fine, it's just the CI/CD part that fails. There haven't been any new packages or plugins for Serverless since the last successful deploy. I'm using serverless-webpack if that makes any difference. Code for that is below. Has anyone ran into this before?
`const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');
const fs = require('fs');
console.log(slsw.lib.entries);
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function (x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function (mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
module.exports = {
entry: slsw.lib.entries,
externalsPresets: { node: true },
mode: 'development',
module: {
rules: [
{
test: /.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
},
],
},
],
},
externals: nodeModules, // exclude external modules
};
`
The above is our staging environment. Now our development environment is running into another issue
`build step: npm ci --if-present --unsafe-perm
npm ERR! fsevents not accessible from jest-haste-map`
Beta Was this translation helpful? Give feedback.
All reactions