LucyBot-Inc / api-spec-converter

Convert API descriptions between popular formats such as OpenAPI(fka Swagger), RAML, API Blueprint, WADL, etc.
https://lucybot-inc.github.io/api-spec-converter/
MIT License
1.12k stars 182 forks source link

npm install -g fails with permission error #132

Open capouch opened 7 years ago

capouch commented 7 years ago

Installation has failed for me twice, on machines with different architectures and node/npm versions. I get the same error on each platform:

`# npm i -g api-spec-converter /usr/local/bin/api-spec-converter -> /usr/local/lib/node_modules/api-spec-converter/bin/api-spec converter

jsonpath@0.2.12 postinstall /usr/local/lib/node_modules/api-spec-converter/node_modules/jsonpath node lib/aesprim.js > generated/aesprim-browser.js sh: generated/aesprim-browser.js: Permission denied npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! jsonpath@0.2.12 postinstall: node lib/aesprim.js > generated/aesprim-browser.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the jsonpath@0.2.12 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. ╭─────────────────────────────────────╮ │ │ │ Update available 5.3.0 → 5.4.2 │ │ Run npm i -g npm to update │ │ │ ╰─────────────────────────────────────╯ npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2017-09-21T06_47_16_083Z-debug.log`

2017-09-21T06_47_16_083Z-debugLog.txt

rbren commented 7 years ago

Are you able to npm i -g other libraries (e.g. npm i -g webpack)? If not, you can either use sudo, or follow the instructions here

Otherwise, we may just have to downgrade the jsonpath library and open a bug there.

capouch commented 7 years ago

I can and do install global packages all the time. Just ahead of this install, I globally installed "swagger-to-graphql," which is the point of this exercise; the files I'm converting need to be in Swagger v2 format, but they are currently in Swagger v1.

It failed to work with sudo, giving the same permissions error as it did with full root access.

However, while researching, I found a thread where the following syntax was explicated, and it installs just fine this way:

sudo npm install -g api-spec-converter --unsafe-perm=true --allow-root

This works in Linux Slackware64-current. I'm off to the races. Obviously, it may not work for everyone on all architectures, so the jsonpath folks should probably be made aware of the issue.

zaibon commented 6 years ago

Same error here. I'm trying to install as root user so I shouldn't have any problem of permission. Using ubuntu and npm 5.3.0

rbren commented 6 years ago

Hrm, I'm still unable to repro, also with npm@5.3.0 on ubuntu (14.04)

Any other details you can think of that might help us reproduce/diagnose? In the meantime, sudo npm install -g api-spec-converter --unsafe-perm=true --allow-root seems to work.

zaibon commented 6 years ago

sudo npm install -g api-spec-converter --unsafe-perm=true --allow-root worked for me too. I'm using ubuntu as a docker container, don't know if that could impact. and here is the detail of the distro:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
khaledkbadr commented 6 years ago

I too have the same problem in Fedora

node: v8.9.1 npm: v5.5.1

Distro Details:

LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 27 (Twenty Seven)
Release:    27
Codename:   TwentySeven
fralalonde commented 6 years ago

Same problem on Funtoo. Above solution worked fine. Updating the README with fixed command would be enough IMO.

rbren commented 6 years ago

Added a note in the README pointing to this issue. I don't think we should encourage everyone to add --unsafe_perm --allow_root though

scottw-finao commented 6 years ago

tried with --unsave_perm and --allow_root (running from root) - same result

0x6B386F commented 6 years ago

yarn global add api-spec-converter works for me.

wonk4rol commented 5 years ago

it works for me :)

sudo npm install -g artillery --unsafe-perm=true --allow-root

BobbyBabazadeh commented 5 years ago

sudo npm install -g artillery --unsafe-perm=true --allow-root Worked for me on fedora :) It saved my whole day!

lucamaf commented 5 years ago

worked for me as well

SyedNomi commented 5 years ago

Works on Ubuntu sudo npm install -g artillery --unsafe-perm=true --allow-root

azizzoaib786 commented 5 years ago

Works on ubuntu as well .. npm install -g artillery --allow-root --unsafe-perm=true

nomi-shah commented 5 years ago

Works on Ubuntu sudo npm install -g artillery --unsafe-perm=true --allow-root

ByronGarrido commented 5 years ago

sudo npm install -g artillery --unsafe-perm=true --allow-root

Thanks a lot, it worked for me!

subratamazumder commented 5 years ago

worked for me on Mac as well sudo npm install -g artillery --unsafe-perm=true --allow-root 👍

rajnishtech commented 5 years ago

What is the min node version need to install?

rajnishtech commented 5 years ago

what is the min node and npm version need to install

ManishBhatiCD commented 5 years ago

Not worked for me on mac sudo npm install -g artillery --unsafe-perm=true --allow-root

davenull311 commented 3 years ago

FWIW, sudo npm install -g api-spec-converter --unsafe-perm=true --allow-root worked for me just now (April 2021) on a Mac. Thanks all!

foxweba3 commented 5 months ago

ההתקנה נכשלה אצלי פעמיים, במכונות עם ארכיטקטורות שונות וגרסאות node/npm. אני מקבל את אותה שגיאה בכל פלטפורמה:

`# npm i -g api-spec-converter /usr/local/bin/api-spec-converter -> /usr/local/lib/node_modules/api-spec-converter/bin/api-spec converter

jsonpath@0.2.12 postinstall /usr/local/lib/node_modules/api-spec-converter/node_modules/jsonpath node lib/aesprim.js > generated/aesprim-browser.js sh: generated/aesprim-browser.js: הרשאה נדחתה שגיאה npm! קוד ELIFECYCLE npm ERR! שגיאה 1 npm ERR! jsonpath@0.2.12 לאחר התקנה: node lib/aesprim.js > generated/aesprim-browser.js npm ERR! מצב יציאה 1 npm ERR! שגיאה npm! נכשל בסקריפט שלאחר ההתקנה jsonpath@0.2.12. שגיאה npm! זו כנראה לא בעיה עם npm. סביר להניח שיש פלט רישום נוסף למעלה. ╭───────────────────────────────────── │ │ עדכון זמין 5.3.0 → 5.4. 2 │ │ הפעל npm i -g npm כדי לעדכן │ │ │ ╰────────────────────────────── ─────── ──╯ npm ERR! יומן שלם של ריצה זו ניתן למצוא ב: npm ERR! /root/.npm/_logs/2017-09-21T06_47_16_083Z-debug.log`

2017-09-21T06_47_16_083Z-debugLog.txt