Can't install Gatsby CLI step Quick Start Docs
npm install -g gatsby-cli
gatsby-cli succesfully installed.
/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
# npm -v
6.4.1
# node -v
v10.15.3
# gatsby info --clipboard
bash: gatsby: command not found
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.
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.
when i try with yarn it working clean
@freiksenet ok thanks for your fast respond, i'll try it
@ilomon10 how did you get it to work with yarn? I am facing this issue right now.
It worked for me when we install it as a SuperUser/RootUser in Linux.
$sudo npm install -g gatsby-cli solved the it
Most helpful comment
$sudo npm install -g gatsby-cli solved the it