Npm run js_dev error

Trying to execute "npm run js_dev " as part of the front-end development, and I get this error:

npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/root/.nvm/versions/node/v7.6.0/bin/node" "/root/.nvm/versions/node/v7.6.0/bin/npm" "run" "js_dev"
npm ERR! node v7.6.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] js_dev: `script/gen-service-worker.js && npm run watch_ru_all`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] js_dev script 'script/gen-service-worker.js && npm run watch_ru_all'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the home-assistant-polymer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     script/gen-service-worker.js && npm run watch_ru_all
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs home-assistant-polymer
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls home-assistant-polymer
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

Where should I look for the issue?

looks like sw-cache couldn’t be found: “Cannot find module ‘sw-precache’” in gen-servce-worker.js. so I “npm install sw-cache”… still nothing… “Cannot find module 'sw-precache”.

Anybody know what to do with this? With that many forks on home-assistant-polymer, I can’t imagine that nobody has encountered this before.

here is the npm-debug.log :slight_smile:

0 info it worked if it ends with ok
1 verbose cli [ '/root/.nvm/versions/node/v7.6.0/bin/node',
1 verbose cli   '/root/.nvm/versions/node/v7.6.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'watch_ru_all' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prewatch_ru_all', 'watch_ru_all', 'postwatch_ru_all' ]
5 info lifecycle [email protected]~prewatch_ru_all: [email protected]
6 silly lifecycle [email protected]~prewatch_ru_all: no script for prewatch_ru_all, continuing
7 info lifecycle [email protected]~watch_ru_all: [email protected]
8 verbose lifecycle [email protected]~watch_ru_all: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~watch_ru_all: PATH: /root/.nvm/versions/node/v7.6.0/lib/node_modules/npm/bin/node-gyp-bin:/home/homeassistant/home-assistant/homeassistant/components/frontend/www_static/home-assistant-polymer/node_modules/.bin:/root/.nvm/versions/node/v7.6.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
10 verbose lifecycle [email protected]~watch_ru_all: CWD: /home/homeassistant/home-assistant/homeassistant/components/frontend/www_static/home-assistant-polymer
11 silly lifecycle [email protected]~watch_ru_all: Args: [ '-c',
11 silly lifecycle   '(npm run watch_ru_core & npm run watch_ru_compatibility & npm run watch_ru_demo) && wait' ]
12 silly lifecycle [email protected]~watch_ru_all: Returned: code: 1  signal: null
13 info lifecycle [email protected]~watch_ru_all: Failed to exec watch_ru_all script
14 verbose stack Error: [email protected] watch_ru_all: `(npm run watch_ru_core & npm run watch_ru_compatibility & npm run watch_ru_demo) && wait`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/root/.nvm/versions/node/v7.6.0/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:192:7)
14 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v7.6.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:192:7)
14 verbose stack     at maybeClose (internal/child_process.js:890:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd /home/homeassistant/home-assistant/homeassistant/components/frontend/www_static/home-assistant-polymer
17 error Linux 4.4.0-59-generic
18 error argv "/root/.nvm/versions/node/v7.6.0/bin/node" "/root/.nvm/versions/node/v7.6.0/bin/npm" "run" "watch_ru_all"
19 error node v7.6.0
20 error npm  v4.1.2
21 error code ELIFECYCLE
22 error [email protected] watch_ru_all: `(npm run watch_ru_core & npm run watch_ru_compatibility & npm run watch_ru_demo) && wait`
22 error Exit status 1
23 error Failed at the [email protected] watch_ru_all script '(npm run watch_ru_core & npm run watch_ru_compatibility & npm run watch_ru_demo) && wait'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the home-assistant-polymer package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     (npm run watch_ru_core & npm run watch_ru_compatibility & npm run watch_ru_demo) && wait
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs home-assistant-polymer
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls home-assistant-polymer
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

I sincerely hope somebody knows what this means: I followed the instructions at https://home-assistant.io/developers/development_environment/

and

I’m guessing you ran npm install or the setup script? Like you said, running a seperate install removes 1 error, this might be the cause

I still can’t get rid of the “sw-precache” not found, despite installing it.

Did you install sw-cache or sw-precache? It’s looking for sw-precache but you mentioned installing sw-cache instead

Oops… yes, I just did… different error now…

OK, was also missing uglify-js.

Then tried again, missing frontend.html.
So tried script/build_frontend … missing more stuff.

So… ran script/setup again, then script/build_frontend , now npm run js_dev works.

Success!

And now I’ve got to remember why I was wanting to work on the front end code to start with.

Running script/setup should normally be enough, since the build_frontend one creates non-development frontend (afaik)
The doc can be confusing regarding that setup script, since people can have run it before setting the development flag in the config, and then stuff would not get installed etc