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

Error while install gatsby-cli #14074

Closed
ilomon10 opened this issue May 16, 2019 · 6 comments
Closed

Error while install gatsby-cli #14074

ilomon10 opened this issue May 16, 2019 · 6 comments

Comments

@ilomon10
Copy link

Description

Can't install Gatsby CLI step Quick Start Docs

Steps to reproduce

npm install -g gatsby-cli

Expected result

gatsby-cli succesfully installed.

Actual result

/root/.nvm/versions/node/v10.15.3/bin/gatsby -> /root/.nvm/versions/node/v10.15.3/lib/node_modules/gatsby-cli/lib/index.js

> [email protected] postinstall /root/.nvm/versions/node/v10.15.3/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry
> node src/postinstall.js

internal/modules/cjs/loader.js:584
    throw err;
    ^

Error: Cannot find module '/root/.nvm/versions/node/v10.15.3/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/src/postinstall.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node src/postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-05-16T07_28_52_765Z-debug.log

Environment

# npm -v
6.4.1
# node -v
v10.15.3
# gatsby info --clipboard
bash: gatsby: command not found
@freiksenet
Copy link
Contributor

I couldn't reproduce locally with exact same npm/node versions, however I have a feeling it might be a permission problem for the config file. Are you running this from root user? Your nvm path seems to suggest that.

@freiksenet freiksenet added the status: awaiting author response Additional information has been requested from the author label May 16, 2019
@freiksenet
Copy link
Contributor

Ok, we repro'd it. This indeed happens when you have nvm installed as root. A workaround for that would be to run npm install with --unsafe-perm flag. See npm docs.

However, we do not recommend such setups, as this opens a vector of attack. I advice you to install nvm as a regular, non-root user.

@freiksenet freiksenet removed the status: awaiting author response Additional information has been requested from the author label May 16, 2019
@ilomon10
Copy link
Author

when i try with yarn it working clean

@freiksenet ok thanks for your fast respond, i'll try it

@doverradio
Copy link

@ilomon10 how did you get it to work with yarn? I am facing this issue right now.

@ayanbag
Copy link

ayanbag commented Apr 14, 2020

It worked for me when we install it as a SuperUser/RootUser in Linux.

@younessdev9
Copy link

$sudo npm install -g gatsby-cli solved the it

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

5 participants