Skip to content

npm install -g hexo-cli failed #2695

Closed
Closed
@Lua12138

Description

@Lua12138

Environment Info

Works in Docker (node:alpine / node:latest)

# node -v
v8.2.1
# npm ls --depth 0
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.2.1
# npm version
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.2.1
{ npm: '5.3.0',
  ares: '1.10.1-DEV',
  cldr: '31.0.1',
  http_parser: '2.7.0',
  icu: '59.1',
  modules: '57',
  node: '8.2.1',
  openssl: '1.0.2l',
  tz: '2017b',
  unicode: '9.0',
  uv: '1.13.1',
  v8: '5.8.283.41',
  zlib: '1.2.11' }

For question

npm info using npm@5.3.0
npm info using node@v8.2.1
npm ERR! path /root/.npm/_logs
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall scandir
npm ERR! Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm ERR!  { Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm ERR!   stack: 'Error: EACCES: permission denied, scandir \'/root/.npm/_logs\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'scandir',
npm ERR!   path: '/root/.npm/_logs' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
glob error { Error: EACCES: permission denied, scandir '/root/.npm/_logs'
  stack: 'Error: EACCES: permission denied, scandir \'/root/.npm/_logs\'',
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/root/.npm/_logs' }
npm info lifecycle hexo-util@0.6.1~prebuild:highlight: hexo-util@0.6.1
npm info lifecycle hexo-util@0.6.1~build:highlight: hexo-util@0.6.1

> hexo-util@0.6.1 build:highlight /usr/local/lib/node_modules/hexo-cli/node_modules/hexo-util
> node scripts/build_highlight_alias.js > highlight_alias.json

sh: can't create highlight_alias.json: Permission denied
npm info lifecycle hexo-util@0.6.1~build:highlight: Failed to exec build:highlight script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hexo-util@0.6.1 build:highlight: `node scripts/build_highlight_alias.js > highlight_alias.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hexo-util@0.6.1 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) /root/.config │
└───────────────────────────────────────────────────┘
npm info lifecycle hexo-util@0.6.1~postinstall: Failed to exec postinstall script
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/hexo-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 243
npm ERR! hexo-util@0.6.1 postinstall: `npm run build:highlight`
npm ERR! Exit status 243
npm ERR!
npm ERR! Failed at the hexo-util@0.6.1 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/2017-08-09T07_01_54_965Z-debug.log

log

# cat /root/.npm/_logs/2017-08-09T07_01_54_965Z-debug.log
3895 verbose unlock done using /root/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
3896 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/hexo-cli/node_modules/fsevents):
3897 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3898 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
3898 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
3898 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
3898 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
3899 verbose stack Error: hexo-util@0.6.1 postinstall: `npm run build:highlight`
3899 verbose stack Exit status 243
3899 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:289:16)
3899 verbose stack     at emitTwo (events.js:125:13)
3899 verbose stack     at EventEmitter.emit (events.js:213:7)
3899 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
3899 verbose stack     at emitTwo (events.js:125:13)
3899 verbose stack     at ChildProcess.emit (events.js:213:7)
3899 verbose stack     at maybeClose (internal/child_process.js:921:16)
3899 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
3900 verbose pkgid hexo-util@0.6.1
3901 verbose cwd /
3902 verbose Linux 4.9.36-moby
3903 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "hexo-cli"
3904 verbose node v8.2.1
3905 verbose npm  v5.3.0
3906 error code ELIFECYCLE
3907 error errno 243
3908 error hexo-util@0.6.1 postinstall: `npm run build:highlight`
3908 error Exit status 243
3909 error Failed at the hexo-util@0.6.1 postinstall script.
3909 error This is probably not a problem with npm. There is likely additional logging output above.
3910 verbose exit [ 243, true ]

Activity

NoahDragon

NoahDragon commented on Aug 9, 2017

@NoahDragon
Member

Have you tried the solution listed here?

Lua12138

Lua12138 commented on Aug 10, 2017

@Lua12138
Author

Thanks. It works now.

Solution

# npm config set user 0
# npm config set unsafe-perm true
# npm install -g hexo-cli
fredmj

fredmj commented on Aug 12, 2017

@fredmj

Thanks it's worked for me on virtualbox5/CentOS7.
Is a patch on the road?
Hexo look pretty great and I really wana try it in Production.
So I'like to be sure that all security and permissions considerations are ok.

Config:
Host:CentOS Linux release 7.3.1611 (Core)+ virtualbox 5.1.26r117224
Guest:

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core)

Installation
install NodeJS and upadte npm with:

111  curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
112  yum install -y nodejs
113  npm install npm@latest -g

[root@localhost ~]# node -v
v8.3.0
[root@localhost ~]# npm --version
5.3.0

Troubles

FIRST HEXO INSTALLATION FAILED*

*from a fresh install

[root@localhost opt]# npm install hexo-cli -g

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

dtrace-provider@0.8.5 install /usr/lib/node_modules/hexo-cli/node_modules/dtrace-provider
node scripts/install.js

hexo-util@0.6.1 postinstall /usr/lib/node_modules/hexo-cli/node_modules/hexo-util
npm run build:highlight

**> hexo-util@0.6.1 build:highlight /usr/lib/node_modules/hexo-cli/node_modules/hexo-util

node scripts/build_highlight_alias.js > highlight_alias.json
sh: highlight_alias.json: Permission non accordée**
(PERMISSION DENIED)**
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hexo-util@0.6.1 build:highlight: node scripts/build_highlight_alias.js > highlight_alias.json
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hexo-util@0.6.1 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 U S E R : (id -gn $USER) /root/.config │
└───────────────────────────────────────────────────┘
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/hexo-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hexo-util@0.6.1 postinstall: npm run build:highlight
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hexo-util@0.6.1 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/2017-08-12T09_57_09_843Z-debug.log

Soluce

HEXO INSTALLATION PASS

[root@localhost opt]# npm config set user 0
[root@localhost opt]# npm config set unsafe-perm true
[root@localhost opt]# npm install -g hexo-cli

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

dtrace-provider@0.8.5 install /usr/lib/node_modules/hexo-cli/node_modules/dtrace-provider
node scripts/install.js

hexo-util@0.6.1 postinstall /usr/lib/node_modules/hexo-cli/node_modules/hexo-util
npm run build:highlight

hexo-util@0.6.1 build:highlight /usr/lib/node_modules/hexo-cli/node_modules/hexo-util
node scripts/build_highlight_alias.js > highlight_alias.json

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/hexo-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

  • hexo-cli@1.0.3
    added 217 packages in 11.705s
yyman001

yyman001 commented on Mar 17, 2018

@yyman001

loading [ .......] | extract:fsevents: sill pacote fsevents@http://r.cnpmjs.org/fsevents/download/fsevents-1.1.3.tgz
will stop...i try it for more...

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Lua12138@yyman001@NoahDragon@fredmj

        Issue actions

          npm install -g hexo-cli failed · Issue #2695 · hexojs/hexo