npm publish --access=public send package twice and ends with 403 error

Hello,

I’m trying to publish a scoped package to npmjs.com.
Actually, my package is published twice.
First publication is OK but the second is failing with a 403 error which is expected.
I can’t figure out why my package is published twice when I run the command npm publish --access=public.

Complete verbose stack trace below

npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'publish',
npm verb cli   '--access=public',
npm verb cli   '--verbose' ]
npm info using npm@6.12.0
npm info using node@v10.16.3
npm verb npm-session 8aeb9cf7fd7a8c07
npm verb publish [ '.' ]
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~prepublish: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~prepare: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~prepublishOnly: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~prepack: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~postpack: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm notice 
npm notice 📦  @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm notice === Tarball Contents === 
npm notice 397B  plugin.js                           
npm notice 542B  package.json                        
npm notice 1.0kB README.md                           
npm notice 4.4kB src/components/VectorPieProgress.vue
npm notice === Tarball Details === 
npm notice name:          @mc2interaction/vue-vector-pie-progress 
npm notice version:       1.0.17-2                                
npm notice package size:  2.2 kB                                  
npm notice unpacked size: 6.3 kB                                  
npm notice shasum:        6c70fac6ec230d865b48dc0f866ef0be89fefa81
npm notice integrity:     sha512-u6616ghssUQ1d[...]lXv0Ld4eggBzg==
npm notice total files:   4                                       
npm notice 
npm http fetch PUT 200 https://registry.npmjs.org/@mc2interaction%2fvue-vector-pie-progress 6034ms
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~publish: @mc2interaction/vue-vector-pie-progress@1.0.17-2

> @mc2interaction/vue-vector-pie-progress@1.0.17-2 publish .
> npm publish --access=public --verbose

npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'publish',
npm verb cli   '--access=public',
npm verb cli   '--verbose' ]
npm info using npm@6.12.0
npm info using node@v10.16.3
npm verb npm-session 3af750b3fc828075
npm verb publish [ '.' ]
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~prepublish: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~prepare: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~prepublishOnly: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~prepack: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~postpack: @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm notice 
npm notice 📦  @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm notice === Tarball Contents === 
npm notice 397B  plugin.js                           
npm notice 542B  package.json                        
npm notice 1.0kB README.md                           
npm notice 4.4kB src/components/VectorPieProgress.vue
npm notice === Tarball Details === 
npm notice name:          @mc2interaction/vue-vector-pie-progress 
npm notice version:       1.0.17-2                                
npm notice package size:  2.2 kB                                  
npm notice unpacked size: 6.3 kB                                  
npm notice shasum:        6c70fac6ec230d865b48dc0f866ef0be89fefa81
npm notice integrity:     sha512-u6616ghssUQ1d[...]lXv0Ld4eggBzg==
npm notice total files:   4                                       
npm notice 
npm http fetch PUT 403 https://registry.npmjs.org/@mc2interaction%2fvue-vector-pie-progress 648ms
npm verb stack Error: 403 Forbidden - PUT https://registry.npmjs.org/@mc2interaction%2fvue-vector-pie-progress - You cannot publish over the previously published versions: 1.0.17-2.
npm verb stack     at res.buffer.catch.then.body (/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:104:15)
npm verb stack     at process._tickCallback (internal/process/next_tick.js:68:7)
npm verb statusCode 403
npm verb pkgid @mc2interaction/vue-vector-pie-progress@1.0.17-2
npm verb cwd /home/bouchezb/workspace/mc2interaction/vue-vector-pie-progress
npm verb Linux 4.15.0-65-generic
npm verb argv "/usr/bin/node" "/usr/local/bin/npm" "publish" "--access=public" "--verbose"
npm verb node v10.16.3
npm verb npm  v6.12.0
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/@mc2interaction%2fvue-vector-pie-progress - You cannot publish over the previously published versions: 1.0.17-2.
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.
npm verb exit [ 1, true ]
npm timing npm Completed in 1115ms

Thanks for your support.
Regards.

Have a look at the commands you are running in the lifecycle scripts, especially publish. Do you actually have a publish script?

npm info lifecycle @mc2interaction/vue-vector-pie-progress@1.0.17-2~publish: @mc2interaction/vue-vector-pie-progress@1.0.17-2

https://docs.npmjs.com/misc/scripts

I was not aware that scripts keys are acting like some kind of hooks.

Indeed i had created an alias for publication named publish which was causing a double publication.
I changed the key to a non reserved word in npm lifecycle and everything is OK now.
Thanks a lot for your support.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.