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] pack wrongly errors with [email protected] #3132

Closed
zepatrik opened this issue Apr 23, 2021 · 3 comments · Fixed by npm/pacote#78
Closed

[BUG] pack wrongly errors with [email protected] #3132

zepatrik opened this issue Apr 23, 2021 · 3 comments · Fixed by npm/pacote#78
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release

Comments

@zepatrik
Copy link

Current Behavior:

With [email protected] we see problems with some scripts that use npm pack, it works without a problem on [email protected]
It errors recently with Invalid package, must have name and version, while it worked before without a problem.

Expected Behavior:

npm pack to work as before

Steps To Reproduce:

$ npm i -g [email protected]
$ npm pack [email protected]
npm notice 
npm notice 📦  [email protected]
npm notice === Tarball Contents === 
npm notice 11.4kB CONTRIBUTING.md                          
npm notice 11.4kB LICENSE                                  
npm notice 418B   README.md                                
npm notice 1.4kB  SECURITY.md                              
npm notice 92B    .github/FUNDING.yml                      
npm notice 515B   .github/ISSUE_TEMPLATE/bug_report.md     
npm notice 538B   .github/ISSUE_TEMPLATE/config.yml        
npm notice 563B   .github/ISSUE_TEMPLATE/feature_request.md
npm notice 187B   .github/semantic.yml                     
npm notice 718B   .github/workflows/closed_references.yml  
npm notice 473B   .github/workflows/labels.yml             
npm notice 1.2kB  .github/workflows/publish.yml            
npm notice 302B   .github/workflows/release_tagger.yml     
npm notice 1.1kB  .github/workflows/stale.yml              
npm notice 338B   .github/workflows/test.yml               
npm notice 34B    .reference-ignore                        
npm notice 712B   package.json                             
npm notice 177B   prettier.config.js                       
npm notice 174B   prettier.config.ts                       
npm notice 59B    tsconfig.json                            
npm notice === Tarball Details === 
npm notice name:          ory-prettier-styles                     
npm notice version:       1.1.2                                   
npm notice filename:      ory-prettier-styles-1.1.2.tgz           
npm notice package size:  12.0 kB                                 
npm notice unpacked size: 31.7 kB                                 
npm notice shasum:        750a35ab29d09ae1a95173ff6d11f70ec262aaaa
npm notice integrity:     sha512-J7YcNdGlfTKCX[...]uKWhZeaeb6Z/A==
npm notice total files:   20                                      
npm notice 
ory-prettier-styles-1.1.2.tgz

$ npm i -g [email protected]
$ npm pack [email protected]
npm ERR! Invalid package, must have name and version

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/patrik/.npm/_logs/2021-04-23T12_30_35_771Z-debug.log

$ cat /home/patrik/.npm/_logs/2021-04-23T12_30_35_771Z-debug.log
0 verbose cli [
0 verbose cli   '/home/patrik/.nvm/versions/node/v14.15.5/bin/node',
0 verbose cli   '/home/patrik/.nvm/versions/node/v14.15.5/bin/npm',
0 verbose cli   'pack',
0 verbose cli   '[email protected]'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 2ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/home/patrik/.nvm/versions/node/v14.15.5/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:/home/patrik/git/keto/.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/home/patrik/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/home/patrik/.nvm/versions/node/v14.15.5/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 9ms
18 timing npm:load:configload Completed in 9ms
19 timing npm:load:setTitle Completed in 0ms
20 timing npm:load:setupLog Completed in 2ms
21 timing npm:load:cleanupLog Completed in 3ms
22 timing npm:load:configScope Completed in 0ms
23 timing npm:load:projectScope Completed in 0ms
24 timing npm:load Completed in 16ms
25 timing config:load:flatten Completed in 3ms
26 timing command:pack Completed in 24ms
27 verbose stack Error: Invalid package, must have name and version
27 verbose stack     at Pack.pack (/home/patrik/.nvm/versions/node/v14.15.5/lib/node_modules/npm/lib/pack.js:57:15)
28 verbose cwd /home/patrik/git/keto
29 verbose Linux 5.10.30-1-MANJARO
30 verbose argv "/home/patrik/.nvm/versions/node/v14.15.5/bin/node" "/home/patrik/.nvm/versions/node/v14.15.5/bin/npm" "pack" "[email protected]"
31 verbose node v14.15.5
32 verbose npm  v7.11.0
33 error Invalid package, must have name and version
34 verbose exit 1

Environment:

see steps above

Thanks a lot ❤️

@zepatrik zepatrik added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Apr 23, 2021
zepatrik added a commit to ory/keto that referenced this issue Apr 23, 2021
@zepatrik zepatrik changed the title [BUG] pack wrongly errors when [BUG] pack wrongly errors with [email protected] Apr 23, 2021
@zepatrik
Copy link
Author

zepatrik commented Apr 23, 2021

So the error comes from 42e0587#diff-eabad0b45ec780b8b57ae6e3d47fd7d063680bea3acdc6b98a4b45ba3b808cccR56-R58 introduced through #3115.
I guess checking the manifest._id is not that reliable, from the pacote package documentation I'd say maybe rather use manifest._resolved?

$ npx pacote manifest ory-prettier-styles
{
  name: 'ory-prettier-styles',
  version: '1.1.2',
  devDependencies: {
    prettier: '^2.1.1',
    typescript: '^4.0.2',
    '@types/node': '^14.6.2',
    '@types/prettier': '^2.1.0'
  },
  dist: {
    integrity: 'sha512-J7YcNdGlfTKCXAHEoFl9lp5EhnIASGgM5ua9Y+8OdWtS9tXJTik5xFYCF6xS46tpI3sk8cxFguKWhZeaeb6Z/A==',
    shasum: '750a35ab29d09ae1a95173ff6d11f70ec262aaaa',
    tarball: 'https://registry.npmjs.org/ory-prettier-styles/-/ory-prettier-styles-1.1.2.tgz',
    fileCount: 20,
    unpackedSize: 31706,
    'npm-signature': '-----BEGIN PGP SIGNATURE-----\r\n' +
      'Version: OpenPGP.js v3.0.13\r\n' +
      'Comment: https://openpgpjs.org\r\n' +
      '\r\n' +
      'wsFcBAEBCAAQBQJf9NoKCRA9TVsSAnZWagAAdcEP/3LTxjl7kdcKFgr/EwFG\n' +
      'd/g73qTRgj9olKXZDBmUD6bOgiW+zGiwQF51mMDq9AlY2EL8WYGMdqnW7bmI\n' +
      '0eFDbogEqwp40bcFcLhdDoQsuXNQAQBgACA3ph1/p0XxzaGCs/0UE2ufs7J0\n' +
      '6i/rdq9wzZeTMOCPJndIG9kDjNc3oUiZAIqk/MgtHpg8v+92Xp6RXvUqRCU1\n' +
      'yxO/PtU0gVzlHQ8R/Aey8k3zalV7n/CDRs0PnUpmCXVSpHMhvDtKQB6A26/q\n' +
      'MgIzovQxSC6PpGXMa9f8G2atu+9zbDwcRfQpIhSom0UJsjo4CmYZ215RYx5O\n' +
      'ap61z5xAQkVmlYDj7F7ZtvWNIu43PX3SjCrsZWwRfJOfai3Em2S9gQUrQTt+\n' +
      '8PoQnUdUT29kBB7RMAYE1rApnlD1vEJUBifKCEQfRdnZ4f3bUoF6HbkBm+gl\n' +
      'PKOU/daQH4TdAc+nQQ1fdb6xebiHp9GKsQAconc3A/wfVaicoWoh5m2ETcnM\n' +
      'Mu9oiZDwtZFaQUgPU4Vn/2K81/Nag4pMeOaiJzinV8uxOEzeifYUuX3zYyT4\n' +
      'f94f45Y8gt9Su/7LZWKmEMih4F1Vw53UI4tJJ1iQoh4voW13sWwTDhvHMCGI\n' +
      'ZE2auFaZCnO5aGmgQcmJcQPIxgzR/uIq4nsr45L1D/+UZl5o3GRccbua/z94\n' +
      '19pW\r\n' +
      '=Bk+6\r\n' +
      '-----END PGP SIGNATURE-----\r\n'
  },
  _resolved: 'https://registry.npmjs.org/ory-prettier-styles/-/ory-prettier-styles-1.1.2.tgz',
  _from: 'ory-prettier-styles@',
  _integrity: 'sha512-J7YcNdGlfTKCXAHEoFl9lp5EhnIASGgM5ua9Y+8OdWtS9tXJTik5xFYCF6xS46tpI3sk8cxFguKWhZeaeb6Z/A=='
}

@wraithgar
Copy link
Member

We'll have to dig into why pacote isn't adding that id to these items. afaik it's supposed to be.

@wraithgar
Copy link
Member

Yeah when it fetches the manifest from the registry it uses a completely different codepath, resulting in a wholly different manifest format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release
Projects
None yet
2 participants