serverless-webpack icon indicating copy to clipboard operation
serverless-webpack copied to clipboard

Error: yarn install --frozen-lockfile --non-interactive failed with code 1

Open juztinlazaro opened this issue 2 years ago • 4 comments

any fix on this? also having an issue in

issue:

× Stack *****-serverless-sit failed to deploy (6s)
Environment: linux, node 18.12.1, framework 3.36.0 (local), plugin 7.1.0, SDK 4.4.0
Credentials: Local, environment variables
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: yarn install --frozen-lockfile --non-interactive failed with code 1
    at ChildProcess.<anonymous> (/home/circleci/project/node_modules/serverless-webpack/lib/utils.js:92:16)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)

2 deprecations found: run 'serverless doctor' for more details

custom

webpack:
  webpackConfig: serverless_v3/webpack.config.js
  includeModules:
    forceInclude:
      - lodash
      - moment
      - es6-promisify
      - axios
      - https
      - axios-retry
      - error-stack-parser
      - stackframe
      - stack-generator
      - stacktrace-gps
      - '@loanmarket/logger-core'
      - '@loanmarket/logger-cloud-watch'
  packager: 'yarn'

webpackconfig

const path = require('path');
const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');

module.exports = {
  entry: slsw.lib.entries,
  target: 'node',
  mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
  resolve: {
    alias: {
      lib: path.resolve(__dirname, 'lib/'),
      services: path.resolve(__dirname, 'services/'),
      builders: path.resolve(__dirname, 'builders/'),
      constants: path.resolve(__dirname, 'constants/'),
      config: path.resolve(__dirname, 'config/'),
      shared: path.resolve(__dirname, '../shared/'),
    },
  },
  optimization: {
    // We no not want to minimize our code.
    minimize: false,
  },
  performance: {
    // Turn off size warnings for entry points
    hints: false,
  },
  devtool: 'nosources-source-map',
  externals: [nodeExternals()],
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
          },
        ],
      },
    ],
  },
  output: {
    libraryTarget: 'commonjs2',
    path: path.join(__dirname, '.webpack'),
    filename: '[name].js',
    sourceMapFilename: '[file].map',
  },
};

Serverless-Webpack Version you're using: "serverless-webpack": "5.3.0", Webpack version you're using: "webpack": "5.81.0", Serverless Framework Version you're using: "serverless": "3.36.0",

juztinlazaro avatar Nov 14 '23 05:11 juztinlazaro

Can you run yarn install --frozen-lockfile --non-interactive locally to see how it goes?

j0k3r avatar Nov 14 '23 07:11 j0k3r

Hi @j0k3r running locally

$ yarn install --frozen-lockfile --non-interactive
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
warning Resolution field "[email protected]" is incompatible with requested version "json5@^2.1.2"
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
warning Resolution field "[email protected]" is incompatible with requested version "minimatch@^3.1.1"
warning Resolution field "[email protected]" is incompatible with requested version "is-svg@^2.0.0"
warning Resolution field "[email protected]" is incompatible with requested version "minimatch@^5.0.1"
warning Resolution field "[email protected]" is incompatible with requested version "json5@^2.2.3"
warning Resolution field "[email protected]" is incompatible with requested version "json5@^0.5.1"
warning Resolution field "[email protected]" is incompatible with requested version "minimatch@^3.1.2"
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
warning Resolution field "[email protected]" is incompatible with requested version "flat@^4.1.0"
warning Resolution field "[email protected]" is incompatible with requested version "degenerator@^2.2.0"
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
warning Resolution field "[email protected]" is incompatible with requested version "xml2js@~0.4.1"
warning Resolution field "[email protected]" is incompatible with requested version "json5@^2.1.2"
warning Resolution field "[email protected]" is incompatible with requested version "tar@^6.1.15"
warning Resolution field "[email protected]" is incompatible with requested version "flat@^5.0.2"
warning Resolution field "[email protected]" is incompatible with requested version "minimatch@^5.1.0"
warning Resolution field "[email protected]" is incompatible with requested version "[email protected]"
success Already up-to-date.
✨  Done in 1.06s.

juztinlazaro avatar Nov 14 '23 09:11 juztinlazaro

Hi @j0k3r i notice the error came up when include the private dependecy in forceInclude

  - '@loanmarket/logger-core'
  - '@loanmarket/logger-cloud-watch'

juztinlazaro avatar Nov 14 '23 10:11 juztinlazaro

I just ran into this. I was using a package without it being installed, and it works in dev because some other package depended on it. But when webpacking, it shakes it out. So make sure you are including all packages you are importing from explicitly in package.json

davecoffin avatar Jan 24 '24 19:01 davecoffin