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

Admin build fails with NPM 8.4.0 (older Shopware 6 version) and now with NPM 8.6.0 #136

Closed
AndreasA opened this issue Feb 4, 2022 · 18 comments

Comments

@AndreasA
Copy link
Contributor

AndreasA commented Feb 4, 2022

PHP Version

8.4

Shopware Version

6.4.7.0

Expected behaviour

Admin build to succeed.

Actual behaviour

npm clean-install fails. Not sure if the lock file should be updated or the admin task should instead just use npm install instead of npm clean-install because npm install works. Probably best to use npm install instead and also do so in build-storefront.sh

How to reproduce

Install node ^16, npm ^8.4 and install Shopware 6.4.7.0 in the production template and execute ./bin/build-administration.sh . It will fail with:

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: mocha@7.2.0 from lock file
npm ERR! Missing: ansi-colors@3.2.3 from lock file
npm ERR! Missing: browser-stdout@1.3.1 from lock file
npm ERR! Missing: chokidar@3.3.0 from lock file
....
@shyim
Copy link
Member

shyim commented Feb 4, 2022

Hmm we should do npm install --no-save or pin the older npm version

@shyim
Copy link
Member

shyim commented Feb 4, 2022

You could install https://github.com/FriendsOfShopware/shopware-cli and use shopware-cli project admin-build until its fixed somehow in the template

@shyim
Copy link
Member

shyim commented Feb 4, 2022

I have created an internal issue and pushed it https://issues.shopware.com/issues/NEXT-19945?

@AndreasA
Copy link
Contributor Author

AndreasA commented Feb 4, 2022

For now I have pinned the version to 8.3 in the CI. though I think using npm install --no-save might make more sense.

@Drumm3r
Copy link

Drumm3r commented Feb 4, 2022

We had the same issue. npm released version 8.4.1 8 hours ago (https://www.npmjs.com/package/npm?activeTab=versions). We solved this by using npm version 8.4.0 instead of latest.

The "issue" was created because npm fixed a bug. They didn't validate the lockfiles:
npm/cli@457e0ae

@AndreasA
Copy link
Contributor Author

AndreasA commented Feb 7, 2022

Hmm... Interesting, personally I think that this is a breaking change in NPM and should have been a NPM v9.x release but that aside it seems to be easily fixable by calling npm install once to update the lock file accordingly.

@ioanok
Copy link
Contributor

ioanok commented Feb 10, 2022

So what is the fix for this issue? It's still present in v6.4.8.0...

@AndreasA
Copy link
Contributor Author

AndreasA commented Mar 8, 2022

@shyim I could be wrong but I think the shopware/platform pipelines are not also failing due to this: cipm 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.

I get e.g. now for the PHPUnit pipelines: https://github.com/shopware/platform/runs/5463997380?check_suite_focus=true

@shyim
Copy link
Member

shyim commented Mar 8, 2022

Is your fork maybe out of date?

@AndreasA
Copy link
Contributor Author

AndreasA commented Mar 8, 2022

@shyim shouldn't be I just fetched origin/trunk today. but the same issue is on the trunk branch on a commit from a few hours ago, see:
https://github.com/shopware/platform/runs/5464261376?check_suite_focus=true
shopware/shopware@575ea22
https://github.com/shopware/platform/commits/trunk

I think it happens since sometime yesterday after checking the commit history.

@christoph-kluge
Copy link

christoph-kluge commented Apr 13, 2022

I've stubmled upon this with some team members today. After performing npm-install inside the administration everything was fine.

Interesstingly it seems that I had those missing packages inside the npm-cache while other's didn't. For me everything was fine but on a fresh install this failed.

Here's the quickfix:

Edit#1

Downgrading npm to 8.3.2 was fixing it.

$ npm install -g 8.3.2

@AndreasA
Copy link
Contributor Author

AndreasA commented Apr 13, 2022

8.4 and 8.5 seems to work now with 6.4.10.0. However, there seems to be a new issue with 8.6.0:

npm ERR! Conflicting peer dependency: eslint@5.16.0
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^4.19.1 || ^5.3.0" from eslint-config-airbnb-base@13.2.0
npm ERR!   node_modules/eslint-config-airbnb-base
npm ERR!     dev eslint-config-airbnb-base@"13.2.0" from the root project
npm ERR!     eslint-config-airbnb-base@"^13.2.0" from @shopware-ag/eslint-config-base@1.0.0
npm ERR!     node_modules/@shopware-ag/eslint-config-base
npm ERR!       @shopware-ag/eslint-config-base@"1.0.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

@AndreasA
Copy link
Contributor Author

Regarding 8.6.0 it is most likely related to this: npm/cli#4664 as mentioned in the ticket it was probably closed pre-maturely and is actually an issue with 8.6.0 but not 100% sure, will depend on feedback on that issue.

@AndreasA AndreasA changed the title Admin build fails with NPM 8.4.0 (maybe also storefront) Admin build fails with NPM 8.4.0 (older Shopware 6 version) and now with NPM 8.6.0 Apr 15, 2022
@AndreasA
Copy link
Contributor Author

In any case it would probably make sense to add some CI tests that automatically tries to build storefront/admin with new released NPM / node version to ensure it still works or not and if not, it should be fixed. Or even better to ensure potential issues cannot occur in the first place lilke e.g. an out-of-date lock file (8.4.0 issue) and now I would guess a dependency was updated but not its own dependencies which results in the issue above?

Though I doubt all these issues can be avoided. Personally I think NPM is more at fault here for changing such behaviors in minor versions.

@AndreasA
Copy link
Contributor Author

Any news regarding NPM 8.6 and newer?

@lutek
Copy link

lutek commented Oct 10, 2022

I have the same error on build with image shopware/development:7.4-composer-2 where is new npm version (8.15.0)

According to npm/cli#5113

you can change in build-administration.sh
from:
npm clean-install --prefix "$path"
to:
npm clean-install --legacy-peer-deps --prefix "$path"

or skip checking if exists package-lock.json and use 'npm install --prefix'. First solution with legacy-peer-deps flag works for me.

@shyim
Copy link
Member

shyim commented Oct 25, 2022

In newer Shopware versions, it is fixed as we have updated that files

@shyim shyim closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2022
@Isengo1989
Copy link

Isengo1989 commented Nov 18, 2022

We still have this issue, the quickfix

npm clean-install --legacy-peer-deps --prefix "$path"

works but is a little annoying due to the merges from the upstream, but fine. We are still locked on 16.10.0 in our prod builds, are there any benefits in the newer version other then less depcreation warnings?

Node: v18.12.1
NPM: 8.19.2
Shopware: 6.4.17.2

=> Installing npm dependencies for swag-language-pack
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! 
 -------------------- ------------------------------------------------------------- 
  Symfony                                                                           
 -------------------- ------------------------------------------------------------- 
  Version              5.4.15                                                       
  Long-Term Support    Yes                                                          
  End of maintenance   11/2024 (in +743 days)                                       
  End of life          11/2025 (in +1108 days)                                      
 -------------------- ------------------------------------------------------------- 
  Kernel                                                                            
 -------------------- ------------------------------------------------------------- 
  Type                 Shopware\Core\Kernel                                         
  Environment          dev                                                          
  Debug                true                                                         
  Charset              UTF-8                                                        
  Cache directory      ./var/cache/dev_hdd94adac0ddc0a47e9674f99dcc037a2 (7.7 MiB)  
  Build directory      ./var/cache/dev_hdd94adac0ddc0a47e9674f99dcc037a2 (7.7 MiB)  
  Log directory        ./var/log (106.3 MiB)                                        
 -------------------- ------------------------------------------------------------- 
  PHP                                                                               
 -------------------- ------------------------------------------------------------- 
  Version              8.0.25                                                       
  Architecture         64 bits                                                      
  Intl locale          de_DE                                                        
  Timezone             UTC (2022-11-18T07:13:40+00:00)                              
  OPcache              true                                                         
  APCu                 true                                                         
  Xdebug               true                                                         
 -------------------- ------------------------------------------------------------- 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants