Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm ci always fails when pdk is installed #381

Closed
tmokmss opened this issue May 1, 2023 · 6 comments
Closed

[BUG] npm ci always fails when pdk is installed #381

tmokmss opened this issue May 1, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@tmokmss
Copy link

tmokmss commented May 1, 2023

Describe the bug

Similar to #282, npm ci raises an error when used with pdk, but this time I have found no workaround as long as we use npm. Please see the reproduction step.

Because npm ci is a crucial command for npm users to install dependencies without modifying package-lock.json, this issue effectively makes pdk unusable for npm users.

I see PDK assumes to be used with pnpm, but is the above behavior expected? I feel it is unreasonable to shut out npm, which is a default package manager for Node.js.

Expected Behavior

npm ci successes.

Current Behavior

npm ci fails with an error.

Reproduction Steps

# run the below commands in an empty directory:
$ npm init -y
$ npm i aws-prototyping-sdk
$ npm i # run this to avoid the error reported on #282
$ npm ci # still get an error below

npm ERR! code EUSAGE
npm ERR!
npm ERR! `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.
npm ERR!
npm ERR! Missing: [email protected] from lock file

Possible Solution

This bundledDependencies part may be working unexpectedly in npm, as in #282 (comment).

https://github.com/aws/aws-prototyping-sdk/blob/cf57586f2567a571c734606d6f003f6a5051bfca/private/projects/nx-monorepo-project.ts#L22-L27

Additional Information/Context

No response

PDK version used

0.17.4

What languages are you seeing this issue on?

No response

Environment details (OS name and version, etc.)

macOS 12.6.5

@tmokmss tmokmss added the bug Something isn't working label May 1, 2023
@JeremyJonas
Copy link
Contributor

Hi @tmokmss, the PDK project (this github repo) itself requires PNPM, but the nx-monorepo project does not require PNPM and should default to projen default packageManager of YARN.

Can you try using the individual packages rather than bundled aws-prototyping-sdk package (eg: @aws-prototyping-sdk/nx-monorepo). The bundled package seems to be having issues and we plan to deprecate it in near future.

@tmokmss
Copy link
Author

tmokmss commented May 1, 2023

Hi @JeremyJonas, you saved my day, thanks! Yeah I also think the bundled package should be deprecated and clearly described in README to avoid confusion.

agdimech added a commit that referenced this issue May 2, 2023
resolve issues related to upgrading nx >= 16

BREAKING CHANGE: Deprecate uber aws-prototyping-sdk package

fix #379, #381, #347
agdimech added a commit that referenced this issue May 3, 2023
resolve issues related to upgrading nx >= 16

BREAKING CHANGE: Deprecate uber aws-prototyping-sdk package

fix #379, #381, #347
agdimech added a commit that referenced this issue May 3, 2023
resolve issues related to upgrading nx >= 16

BREAKING CHANGE: Deprecate uber aws-prototyping-sdk package

fix #379, #381, #347
agdimech added a commit that referenced this issue May 3, 2023
resolve issues related to upgrading nx >= 16

BREAKING CHANGE: Deprecate uber aws-prototyping-sdk package

fix #379, #381, #347
@agdimech
Copy link
Contributor

agdimech commented May 3, 2023

Closed as part of: #384

@agdimech agdimech closed this as completed May 3, 2023
@janeklb
Copy link
Contributor

janeklb commented Oct 5, 2023

npm ci is failing for me too.

pdk 0.22.12
node v18.17.1

cd `mktemp -d`
pdk new --package-manager=npm monorepo-ts
npm ci

results in

npm ERR! code EUSAGE
npm ERR!
npm ERR! `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.
npm ERR!
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR!
npm ERR! Clean install a project
npm ERR!
npm ERR! Usage:
npm ERR! npm ci
npm ERR!
npm ERR! Options:
npm ERR! [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm ERR! [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm ERR!
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
npm ERR!
npm ERR! Run "npm help ci" for more info

What package manager do maintainers of this repo use with pdk? Is everyone using pnpm?

@agdimech
Copy link
Contributor

agdimech commented Oct 16, 2023

Fixed as part of: #602

Be sure to install the latest @aws/pdk cli (> 0.22.16) and re-try.

npm install -g @aws/pdk

@pjoe
Copy link

pjoe commented Nov 2, 2023

This still fails for me using 0.22.30 😢

$ npm --version
9.6.7
$ node --version
v18.17.1
$ npx @aws/pdk --version
0.22.30
$ npx @aws/pdk new monorepo-ts --package-manager=npm
...
👾 Installing dependencies...
👾 install | npm install --legacy-peer-deps

up to date, audited 981 packages in 1s

212 packages are looking for funding
  run `npm fund` for details

3 moderate severity vulnerabilities

...
 >  NX   Successfully ran target eslint for 0 projects


Initialized empty Git repository in /home/pelle/test/pdk/pdk-test/.git/
[main (root-commit) 600f7ad] chore: project created with projen
 19 files changed, 12847 insertions(+)
 create mode 100644 .eslintrc.json
...
 create mode 100644 tsconfig.json

$ npm ci
npm ERR! code EUSAGE
npm ERR!
npm ERR! `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.
npm ERR!
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: @pnpm/[email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR! Missing: [email protected] from lock file
npm ERR!
npm ERR! Clean install a project
npm ERR!
npm ERR! Usage:
npm ERR! npm ci
npm ERR!
npm ERR! Options:
npm ERR! [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm ERR! [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm ERR!
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
npm ERR!
npm ERR! Run "npm help ci" for more info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants