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

Mac install hexo use sudo but sitll permission denied #2785

Closed
anming-john opened this issue Oct 1, 2017 · 9 comments
Closed

Mac install hexo use sudo but sitll permission denied #2785

anming-john opened this issue Oct 1, 2017 · 9 comments

Comments

@anming-john
Copy link

Environment Info

usr/local/bin/hexo -> /usr/local/lib/node_modules/hexo-cli/bin/hexo

[email protected] install /usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider
node scripts/install.js

fs.js:809
return binding.rename(pathModule._makeLong(oldPath),
^

Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider/compile.py' -> '/usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider/binding.gyp'
at Error (native)
at Object.fs.renameSync (fs.js:809:18)
at Object. (/usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider/scripts/install.js:14:4)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)

[email protected] install /usr/local/lib/node_modules/hexo-cli/node_modules/fsevents
node install

[fsevents] Success: "/usr/local/lib/node_modules/hexo-cli/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

[email protected] postinstall /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-util
npm run build:highlight

[email protected] build:highlight /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-util
node scripts/build_highlight_alias.js > highlight_alias.json

sh: highlight_alias.json: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:highlight: node scripts/build_highlight_alias.js > highlight_alias.json
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:highlight script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

┌───────────────────────────────────────────────────────────────┐
│ npm update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /Users/wanganming/.config │
└───────────────────────────────────────────────────────────────┘
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/hexo-cli/node_modules/dtrace-provider):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node scripts/install.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: npm run build:highlight
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! /Users/wanganming/.npm/_logs/2017-10-01T08_53_40_892Z-debug.log
Node version(node -v):
v6.9.5
Your site _config.yml (Optional):

Your theme _config.yml (Optional):

Hexo and Plugin version(npm ls --depth 0):

For BUG

For question

For feature request

@NoahDragon NoahDragon added the question Needs help in usage label Oct 13, 2017
@MindedCoder
Copy link

me too

1 similar comment
@1xuanyuan1
Copy link

me too

@JLHwung
Copy link
Collaborator

JLHwung commented Oct 21, 2017

Rule 1: do not use sudo when you are using hexo
Fix:

sudo chown -R `whoami` /usr/local/lib/node_modules

and never run sudo npm install -g hexo-cli, sudo hexo init blog again.

@leafney
Copy link

leafney commented Oct 27, 2017

@JLHwung is right,Thanks. My operation:

sudo chown -R `whoami` /usr/local/lib/node_modules

and then:

npm install hexo-cli -g

the result is ok ,hexo installed:

$ npm install hexo-cli -g
/usr/local/bin/hexo -> /usr/local/lib/node_modules/hexo-cli/bin/hexo

> [email protected] install /usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider
> node scripts/install.js


> [email protected] install /usr/local/lib/node_modules/hexo-cli/node_modules/fsevents
> node install

[fsevents] Success: "/usr/local/lib/node_modules/hexo-cli/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> [email protected] postinstall /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-util
> npm run build:highlight


> [email protected] build:highlight /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-util
> node scripts/build_highlight_alias.js > highlight_alias.json

+ [email protected]
added 217 packages in 13.67s

@ghost
Copy link

ghost commented Oct 31, 2017

@JLHwung @anming-john , Thanks! I find this solution for a day, now I have solved the problem!

@anming-john
Copy link
Author

@JLHwung Thanks so much , it really work for me!

@brennanMKE
Copy link

I arrived here after having this problem with npm and want to provide the correct answer. Never use sudo to install modules. Running sudo allows anything to happen which is very dangerous. And simply changing ownership of the folder which is outside your home directory will potentially cause trouble if you ever change to a different user account. What you want to do is configure npm so that it uses a directory within your home directory. See the docs on the npm website for the current instructions.

https://docs.npmjs.com/getting-started/fixing-npm-permissions#option-two-change-npms-default-directory

@re-imagined
Copy link

try this
sudo npm install --unsafe-perm --verbose -g hexo

@Markyyylol
Copy link

Whats Hexo? Is it like a botter or what is it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants