-1

I've created a really simple Angular 4 library following this tutorial.

Everything is fine, except for the publishing part. When I run: npm publish dist in console, I get this error:

You do not have permission to publish "dist". Are you logged in as the correct user? : dist

I am logged in as the correct user, so I don't know why this is happening.

M0nst3R
  • 5,186
  • 1
  • 23
  • 36
eli
  • 313
  • 3
  • 6
  • 17
  • Have you tried checking the permissions of your user to the `dist/` directory ? Also have you tried running `cd dist/ && npm publish` ? – M0nst3R Oct 13 '17 at 15:17
  • @GhassenLouhaichi yes, I tried `cd dist/ && npm publish` but I still get the error – eli Oct 13 '17 at 15:19
  • Then check the permissions of your user to the directory. – M0nst3R Oct 13 '17 at 15:19
  • I have full control over it – eli Oct 13 '17 at 15:25
  • You might want to include that in your question then, to avoid having this converstation again ;) – M0nst3R Oct 13 '17 at 15:26
  • I suggest adding screenshots or the outputs of `whoami` and `ls -l | grep dist` from your application directory. – M0nst3R Oct 13 '17 at 15:27
  • It looks like the problem is with npm and not the filesystem, some solutions suggest changing the `name` field in `package.json` because it may be already used, have you tried that ? – M0nst3R Oct 13 '17 at 15:31
  • Have you tried opening cmd or whichever program you are using to run `npm publish dist` as an administrator? – nick zoum Oct 13 '17 at 15:34
  • @nick zoum yes, I tried it , didn't work – eli Oct 13 '17 at 15:38
  • @GhassenLouhaichi I checked `https://npmjs.com/package/myPackage` for my package name but there are no results, so it's not a name problem – eli Oct 13 '17 at 15:40

1 Answers1

0

I solved it. What I had to do, was removing "private":true from package.json inside the dist folder and then run cd dist && npm publish.

eli
  • 313
  • 3
  • 6
  • 17