Dashboard: `npm install` broke out a error that cannot run postinstall script.

Created on 9 Feb 2017  路  10Comments  路  Source: kubernetes/dashboard

In the dashboard directory, after npm install, gulp local-up-cluster, I use gulp serve to serve dashborad for development, but there is a error, and no frontend(9090) was launched.

The serve log is :

gulp serve
[20:01:29] Requiring external module babel-register
[20:01:36] Using gulpfile /opt/k8s/k8s-dashboard/gulpfile.babel.js
[20:01:36] Starting 'clean-packaged-backend-source'...
[20:01:36] Starting 'kill-backend'...
[20:01:36] Finished 'kill-backend' after 294 渭s
[20:01:36] Starting 'locales-for-backend:dev'...
[20:01:36] Starting 'scripts'...
[20:01:36] Starting 'styles'...
[20:01:36] Starting 'buildExistingI18nCache'...
[20:01:37] Finished 'buildExistingI18nCache' after 664 ms
[20:01:37] Starting 'angular-templates'...
[20:01:37] Finished 'locales-for-backend:dev' after 1.55 s
[20:01:37] Finished 'clean-packaged-backend-source' after 1.66 s
[20:01:37] Starting 'package-backend-source'...
[20:02:04] Finished 'scripts' after 29 s
[20:02:06] Finished 'styles' after 30 s
[20:02:06] Starting 'index'...
(node:3736) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Error: Cannot find where you keep your Bower packages.
[20:02:06] Finished 'angular-templates' after 29 s
[20:02:06] Finished 'package-backend-source' after 29 s
[20:02:06] Starting 'link-vendor'...
[20:02:06] Finished 'link-vendor' after 530 渭s
[20:02:06] Starting 'package-backend'...
[20:02:06] Finished 'package-backend' after 4.36 渭s
[20:02:06] Starting 'backend'...
[20:02:42] Finished 'backend' after 36 s
[20:02:42] Starting 'spawn-backend'...
[20:02:42] Finished 'spawn-backend' after 44 ms
Using HTTP port: 9091
Using apiserver-host location: http://localhost:8080
Creating API server client for http://localhost:8080
Successful initial request to the apiserver, version: v1.5.0-beta.0
Creating in-cluster Heapster client
Using random key for csrf signing

Cannot find where you keep your Bower packages ? What's wrong?

kinbug

All 10 comments

Maybe the reason is that postinstall failed, I am trying to execute postinstall manually.

npm install
npm WARN lifecycle [email protected]~postinstall: cannot run in wd %s %s (wd=%s) [email protected] build/postinstall.sh /opt/k8s/dashboard

After executing the cmd build/postinstall.sh, the frontend is up! So now, the question is why the postinstall cannot be running?

@floreks @maciaszczykm Can you look at this?

@olekzabl @wefine Unfortunately I cannot reproduce the problem. Can you provide more detailed description of steps to reproduce? What is your environment?

Hi, @maciaszczykm , FYI.

root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:    16.04
Codename:   xenial
root@ubuntu:~# go env
GOARCH="amd64"
GOBIN="/opt/gobin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/gopath"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build098752711=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
root@ubuntu:~# java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
root@ubuntu:~# gulp -v
[02:25:02] CLI version 3.9.1
root@ubuntu:~# docker version
Client:
 Version:      1.14.0-dev
 API version:  1.26
 Go version:   go1.7.4
 Git commit:   15ab58b
 Built:        Sat Jan  7 11:17:25 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.14.0-dev
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.4
 Git commit:   15ab58b
 Built:        Sat Jan  7 11:17:25 2017
 OS/Arch:      linux/amd64
 Experimental: false

My parters with same env also have the "npm WARN lifecycle [email protected]~postinstall: cannot run in wd %s %s (wd=%s) " error.

I'm always running it without root privileges, maybe that causes the issue. I'll check that later and let you know. In the meantime you can try to run npm i --unsafe-perm instead of npm i and let us know what was the result (you can paste logs too).

Hi, @maciaszczykm , maybe it's ok.

[root@localhost dashboard]# npm i --unsafe-perm

> [email protected] postinstall /root/project/dashboard
> build/postinstall.sh

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] requires a peer of browserify@>= 2.3.0 < 4 but none was installed.

Hmm, so it was the issue if it works now with --unsafe-perm. As you can read in npm documentation:

If npm was invoked with root privileges, then it will change the uid to the user account or uid specified by the user config, which defaults to nobody. Set the unsafe-perm flag to run scripts with root privileges.

Other possible solutions are updating package.json:

"config": {
    "unsafe-perm":true
}

Or changing ownership of work directories with sudo chown -R root ... command (didn't check it).

@kubernetes/dashboard-maintainers We might need to add --unsafe-perm to our getting started guide. What do you think?

Thanks!

Was this page helpful?
0 / 5 - 0 ratings