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

Publish to npm failing #95

Closed
tnrich opened this issue May 16, 2017 · 14 comments
Closed

Publish to npm failing #95

tnrich opened this issue May 16, 2017 · 14 comments

Comments

@tnrich
Copy link

tnrich commented May 16, 2017

Hey there,

I'm getting the following error when trying to use release-it. As you can see I've tried printing out debug info, but am not getting much help from it.

image

Any help would be greatly appreciated. Thanks!

Here's my package.json:

{
  "name": "teselagen-react-components",
  "version": "1.0.4",
  "description": "Teselagen React Component Library",
  "main": "lib/index.js",
  "module": "es/index.js",
  "files": [
    "css",
    "es",
    "lib",
    "umd"
  ],
  "scripts": {
    "build": "nwb build-react-component --copy-files",
    "clean": "nwb clean-module && npm clean-demo",
    "start": "nwb serve-react-demo",
    "test": "nwb test-react",
    "test:coverage": "nwb test-react --coverage",
    "test:watch": "nwb test-react --server",
    "release": "yarn test && yarn build && release-it"
  },
  "dependencies": {
    "redux": "^3.6.0"
  },
  "peerDependencies": {
    "@blueprintjs/core": "^1.17.1",
    "@blueprintjs/datetime": "^1.15.0",
    "@blueprintjs/table": "^1.14.0",
    "react-addons-css-transition-group": "^15.5.2",
    "react-measure": "^1.4.7",
    "react-redux": "^5.0.4",
    "redux-form": "^6.7.0"
  },
  "devDependencies": {
    "@blueprintjs/core": "^1.17.1",
    "@blueprintjs/datetime": "^1.15.0",
    "@blueprintjs/table": "^1.14.0",
    "nwb": "0.15.x",
    "react": "^15.5.4",
    "react-addons-css-transition-group": "^15.5.2",
    "react-dom": "^15.5.4",
    "react-measure": "^1.4.7",
    "react-redux": "^5.0.4",
    "redux-form": "^6.7.0",
    "release-it": "^2.7.3"
  },
  "author": "teselagen",
  "homepage": "https://github.com/TeselaGen/teselagen-react-components",
  "license": "MIT",
  "repository": "https://github.com/TeselaGen/teselagen-react-components",
  "keywords": [
    "react-component",
    "teselagen"
  ]
}
@webpro
Copy link
Collaborator

webpro commented May 16, 2017

Hi @tnrich. Please use the --verbose (or -V) flag for more verbose output. Let's see what it tells us?

@tnrich
Copy link
Author

tnrich commented May 16, 2017

Hey there, thanks for the tip! Didn't see the -V flag in there. It turns out it is an adduser issue:

[execute] npm publish . --tag latest
npm ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tnrich/.npm/_logs/2017-05-16T19_26_22_175Z-debug.log

Right before this I signed into npm using npm adduser. Do I need to do something else?

@webpro
Copy link
Collaborator

webpro commented May 16, 2017

I assume with a manual npm publish, you are getting the same error?

I think there was an error, and you'll need to npm adduser again.

@tnrich
Copy link
Author

tnrich commented May 16, 2017

Nope, it works when I do it manually

@webpro
Copy link
Collaborator

webpro commented May 16, 2017

I'm not sure what the issue is. The user you've added and the author in package.json are the same? What does npm whoami give? Do you use an .npmrc file?

@tnrich
Copy link
Author

tnrich commented May 16, 2017

hey @webpro , here is the output of those commands:

MacBook-Pro:teselagen-react-components tnrich$ npm whoami
teselagen
MacBook-Pro:teselagen-react-components tnrich$ cat package.json
{
  "name": "teselagen-react-components",
  "version": "1.0.14",
  "description": "Teselagen React Component Library",
  "main": "lib/index.js",
  "module": "es/index.js",
  "files": [
    "css",
    "es",
    "lib",
    "umd"
  ],
  "scripts": {
    "build": "nwb build-react-component --copy-files",
    "clean": "nwb clean-module && npm clean-demo",
    "start": "nwb serve-react-demo",
    "test": "nwb test-react",
    "test:coverage": "nwb test-react --coverage",
    "test:watch": "nwb test-react --server",
    "release": "release-it"
  },
  "dependencies": {
    "redux": "^3.6.0"
  },
  "peerDependencies": {
    "@blueprintjs/core": "^1.17.1",
    "@blueprintjs/datetime": "^1.15.0",
    "@blueprintjs/table": "^1.14.0",
    "react-addons-css-transition-group": "^15.5.2",
    "react-measure": "^1.4.7",
    "react-redux": "^5.0.4",
    "redux-form": "^6.7.0"
  },
  "devDependencies": {
    "@blueprintjs/core": "^1.17.1",
    "@blueprintjs/datetime": "^1.15.0",
    "@blueprintjs/table": "^1.14.0",
    "enzyme": "^2.8.2",
    "nwb": "0.15.x",
    "react": "^15.5.4",
    "react-addons-css-transition-group": "^15.5.2",
    "react-dom": "^15.5.4",
    "react-measure": "^1.4.7",
    "react-redux": "^5.0.4",
    "redux-form": "^6.7.0",
    "release-it": "^2.7.3"
  },
  "author": "teselagen",
  "homepage": "https://github.com/TeselaGen/teselagen-react-components",
  "license": "MIT",
  "repository": "https://github.com/TeselaGen/teselagen-react-components",
  "keywords": [
    "react-component",
    "teselagen"
  ]
}

I have no .npmrc file

@tnrich
Copy link
Author

tnrich commented May 16, 2017

Here's the output showing release-it not working, but npm publish working just fine. Very confusing as to why I would be getting this error:

$ release-it
[execute] git config --get remote.origin.url
https://github.com/TeselaGen/teselagen-react-components.git
Release source repo
[execute] git rev-parse --git-dir
.git
[execute] bump package.json 1.0.15
No build command was provided.
[execute] git add package.json
[execute] git diff-index --name-only HEAD --exit-code
package.json
[execute] git commit  --message="Release 1.0.15" .
[master 25b2c84] Release 1.0.15
 1 file changed, 1 insertion(+), 3 deletions(-)
[execute] git tag  --annotate --message="Release 1.0.15" 1.0.15
[execute] git push
To https://github.com/TeselaGen/teselagen-react-components.git
   9fafa64..25b2c84  master -> master
[execute] git push --follow-tags
To https://github.com/TeselaGen/teselagen-react-components.git
 * [new tag]         1.0.15 -> 1.0.15
[execute] npm publish . --tag latest
npm ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tnrich/.npm/_logs/2017-05-16T22_03_48_467Z-debug.log
ERROR
✨  Done in 11.01s.
MacBook-Pro:teselagen-react-components tnrich$ npm publish
+ [email protected]
MacBook-Pro:teselagen-react-components tnrich$ npm whoami
teselagen
MacBook-Pro:teselagen-react-components tnrich$ npm owner ls
teselagen <[email protected]>
tnrich <[email protected]>
MacBook-Pro:teselagen-react-components tnrich$

@webpro
Copy link
Collaborator

webpro commented May 16, 2017

To be honest, I have no idea why npm is behaving differently within the release-it process. I'm doing this all the time myself (also Mac). Can't remember reports regarding this before.

Maybe you can run this on another machine? Just to try and rule out system-specific things (like aliases, or idk).

@webpro
Copy link
Collaborator

webpro commented Jun 7, 2017

Closing this due to inactivity (and the fact I can't reproduce it). If anyone has similar issues, feel free to discuss it here.

@webpro webpro closed this as completed Jun 7, 2017
@Westbrook
Copy link

Westbrook commented Nov 14, 2017

@webpro I wonder if this might have something to do with a collision between npm and yarn. Checkout my verbose error logging here:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'publish',
1 verbose cli   '.',
1 verbose cli   '--tag',
1 verbose cli   'latest' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session abd4660ffb41fa44
5 verbose publish [ '.' ]
6 info lifecycle [email protected]~prepublish: [email protected]
7 info lifecycle [email protected]~prepare: [email protected]
8 verbose lifecycle [email protected]~prepare: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~prepare: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/westbrook/Documents/web/repos/generator-polymer-init-opinionated-element/node_modules/.bin:/Users/westbrook/Documents/web/repos/generator-polymer-init-opinionated-element/node_modules/.bin:/Users/westbrook/.config/yarn/link/node_modules/.bin:/Users/westbrook/Documents/web/repos/generator-polymer-init-opinionated-element/node_modules/.bin:/Users/westbrook/.config/yarn/link/node_modules/.bin:/usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/local/bin/node_modules/npm/bin/node-gyp-bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle [email protected]~prepare: CWD: .
11 silly lifecycle [email protected]~prepare: Args: [ '-c', 'nsp check' ]
12 silly lifecycle [email protected]~prepare: Returned: code: 0  signal: null
13 info lifecycle [email protected]~prepublishOnly: [email protected]
14 info lifecycle [email protected]~prepack: [email protected]
15 info lifecycle [email protected]~postpack: [email protected]
16 verbose getPublishConfig undefined
17 silly mapToRegistry name generator-polymer-init-opinionated-element
18 silly mapToRegistry using default registry
19 silly mapToRegistry registry https://registry.yarnpkg.com/
20 silly mapToRegistry data { type: 'tag',
20 silly mapToRegistry   registry: true,
20 silly mapToRegistry   where: undefined,
20 silly mapToRegistry   raw: 'generator-polymer-init-opinionated-element',
20 silly mapToRegistry   name: 'generator-polymer-init-opinionated-element',
20 silly mapToRegistry   escapedName: 'generator-polymer-init-opinionated-element',
20 silly mapToRegistry   scope: undefined,
20 silly mapToRegistry   rawSpec: '',
20 silly mapToRegistry   saveSpec: null,
20 silly mapToRegistry   fetchSpec: 'latest',
20 silly mapToRegistry   gitRange: undefined,
20 silly mapToRegistry   gitCommittish: undefined,
20 silly mapToRegistry   hosted: undefined }
21 silly mapToRegistry uri https://registry.yarnpkg.com/generator-polymer-init-opinionated-element
22 verbose publish registryBase https://registry.yarnpkg.com/
23 silly publish uploading /var/folders/wm/ctsqsbj17l5dwgfpkyb8v62r0000gn/T/npm-92617-b30d65b4/tmp/fromDir-8326310d/package.tgz
24 verbose stack Error: auth required for publishing
24 verbose stack     at RegClient.publish (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/publish.js:30:14)
24 verbose stack     at BB.fromNode (/usr/local/lib/node_modules/npm/lib/publish.js:182:16)
24 verbose stack     at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
24 verbose stack     at Function.Promise.fromNode.Promise.fromCallback (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:180:30)
24 verbose stack     at BB.fromNode.spread (/usr/local/lib/node_modules/npm/lib/publish.js:181:15)
24 verbose stack     at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
24 verbose stack     at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:509:35)
24 verbose stack     at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
24 verbose stack     at Promise._settlePromiseCtx (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:606:10)
24 verbose stack     at Async._drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12)
24 verbose stack     at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
24 verbose stack     at Immediate.Async.drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
24 verbose stack     at runCallback (timers.js:789:20)
24 verbose stack     at tryOnImmediate (timers.js:751:5)
24 verbose stack     at processImmediate [as _immediateCallback] (timers.js:722:5)
25 verbose cwd /Users/westbrook/Documents/web/repos/generator-polymer-init-opinionated-element
26 verbose Darwin 17.2.0
27 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "publish" "." "--tag" "latest"
28 verbose node v8.9.1
29 verbose npm  v5.5.1
30 error code ENEEDAUTH
31 error need auth auth required for publishing
32 error need auth You need to authorize this machine using `npm adduser`
33 verbose exit [ 1, true ]

I'm able to see my npm whoami and able to npm publish on it's own, but when running release-it I'm thrown the above error regardless. I'm really loving everything else about this software, so I hope the above log can help clarify what's going on.

@webpro
Copy link
Collaborator

webpro commented Nov 14, 2017

Thanks, @Westbrook. Still hard to reproduce (even though I have yarn installed for a while). Looks like npm is somehow using https://registry.yarnpkg.com/ as target registry, causing the ENEEDAUTH. Some seemingly related references:

Could you please try and add this to your package.json:

"publishConfig": {
  "registry": "https://registry.npmjs.org/"
}

Wonder if this helps?

@webpro webpro reopened this Nov 14, 2017
@Westbrook
Copy link

Just noticed that the response I wrote the other day has just been sitting here unsent.

@webpro Thanks. This seems to have been the issue. I'm now able to publish directly with release-it and am much happier for it.

@webpro
Copy link
Collaborator

webpro commented Nov 16, 2017

Thanks for getting back to me with this. Guess I should just add some "common issues" section to the docs.

To summarize: an ENEEDAUTH error and a stack trace like above (including registry https://registry.yarnpkg.com/) while npm publish-ing may be resolved by adding this to package.json:

"publishConfig": {
  "registry": "https://registry.npmjs.org/"
}

@ekoeryanto
Copy link

ekoeryanto commented Oct 28, 2018

Halo, I have this issue but I believe it is yarn link related issue, here is the log

repo: ekoeryanto/vuepress-plugin-sitemap

? Publish vuepress-plugin-sitemap to npm? Yes
ERROR npm notice
npm notice package: [email protected]
npm notice === Tarball Contents ===
npm notice 1.0kB   package.json
npm notice 135B    .editorconfig
npm notice 433B    .release-it.json
npm notice 464B    CHANGELOG.md
npm notice 1.1kB   cli.js
npm notice 1.3kB   index.js
npm notice 1.5kB   README.md
npm notice 152.4kB yarn.lock
npm notice === Tarball Details ===
npm notice name:          vuepress-plugin-sitemap
npm notice version:       1.0.1
npm notice package size:  56.2 kB
npm notice unpacked size: 158.3 kB
npm notice shasum:        dff6d8629638f7ffc4b19a0bd40d20d1d2ff06ff
npm notice integrity:     sha512-fh0z958VJZEMW[...]pWwod2MJH+PpQ==
npm notice total files:   8
npm notice
npm ERR! path C:\Users\sumeko\AppData\Local\Temp\npm-7192-ba1c61b2\tmp\fromDir-aa0dd01e\package.tgz
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\sumeko\AppData\Local\Temp\npm-7192-ba1c61b2\tmp\fromDir-aa0dd01e\package.tgz'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'C:\Users\sumeko\AppData\Local\Temp\npm-7192-ba1c61b2\tmp\fromDir-aa0dd01e\package.tgz']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'C:\Users\sumeko\AppData\Local\Temp\npm-7192-ba1c61b2\tmp\fromDir-aa0dd01e\package.tgz'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'C:\\Users\\sumeko\\AppData\\Local\\Temp\\npm-7192-ba1c61b2\\tmp\\fromDir-aa0dd01e\\package.tgz' },
npm ERR!   isOperational: true,
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'C:\\Users\\sumeko\\AppData\\Local\\Temp\\npm-7192-ba1c61b2\\tmp\\fromDir-aa0dd01e\\package.tgz\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'C:\\Users\\sumeko\\AppData\\Local\\Temp\\npm-7192-ba1c61b2\\tmp\\fromDir-aa0dd01e\\package.tgz' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     O:\Applications\Scoop\persist\nodejs\cache\_logs\2018-10-28T07_05_59_274Z-debug.log

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

O:\Repository\vuepress-plugin-sitemap>yarn unlink
yarn unlink v1.10.1
error No registered package found called "vuepress-plugin-sitemap".
info Visit https://yarnpkg.com/en/docs/cli/unlink for documentation about this command.

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

4 participants