google-home-notification-gateway icon indicating copy to clipboard operation
google-home-notification-gateway copied to clipboard

NPM ERR! building frontend

Open starbuck93 opened this issue 6 years ago • 8 comments

Raspberry Pi 3 running Raspbian Jessie. Successfully cloned and ran npm install. Then failed with a ton of errors on npm run build.

Here's a gist with the debug log

Quick Googling of npm ERR! code ELIFECYCLE errno 2 did not return any help for me.

Thanks in advance for any help.

starbuck93 avatar Mar 29 '18 02:03 starbuck93

I sent the output to a file instead of stdout so I could actually read it and found this.

ERROR in ./node_modules/css-loader?{"importLoaders":1}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-2ccece95","scoped":false,"hasInlineConfig":false}!./node_modules/postcss-loader/lib!./node_modules/sass-loader/...
Module build failed: Error: Node Sass does not yet support your current environment: Linux Unsupported architecture (arm) with Node.js 8.x
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.8.3

Node-Sass does not have an ARM binary available so Node was complaining. It looks like I'll have to compile it from source:

https://github.com/sass/node-sass/issues/1609

starbuck93 avatar Mar 29 '18 02:03 starbuck93

Okay that fixed that issue. I'm getting a new one now:

ERROR in ./frontend/img/models/model-google-home-carbon.png
Module build failed: Error: spawn /home/pi/google-home-notification-gateway/node_modules/optipng-bin/vendor/optipng ENOENT

Which looks like optipng is having a problem and may be solved by npm install gulp-imagemin

starbuck93 avatar Mar 29 '18 03:03 starbuck93

Which looks like optipng is having a problem and may be solved by npm install gulp-imagemin

That didn't work. Same errors as a few minutes ago.

starbuck93 avatar Mar 29 '18 03:03 starbuck93

Ok you try to install GHNG on Pi, didn't know for Node-sass and ARM sorry. I think I'll commit sources already built to solve this issue (should fix the imagemin issue too)

MarlBurroW avatar Mar 29 '18 11:03 MarlBurroW

Ok done, I added the prebuilt public folder to git. So now just re-clone the repository (or pull), and do:

$ npm install

And don't build the frontend, just start the app directly:

$ npm run start

If the $ npm install has finished without error, the app should start correctly.

MarlBurroW avatar Mar 29 '18 11:03 MarlBurroW

I deleted the entire GHNG directory and re-cloned it. Ran npm install and got a new error

https://gist.github.com/starbuck93/a1c04f6d544e6512fa7c22ff7cd7a79f

After a little bit of trial and error... Googled "dns_sd.h: No such file or directory" and found this fix: sudo apt-get install libavahi-compat-libdnssd-dev then ran npm install mdns again.

It looks like it finished successfully but got the same error about eslint needs "peer dependencies". Okay, let's npm install eslint.

Weird. It still came up with the same warning:

npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.

Tried to install fsevents and got

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: arm

But tried npm install again and it didn't exactly fail (it had a warning)

so npm start:

...
throw new Error('Please install sqlite3 package manually');
...

Okay, so npm install sqlite3

10 years later after compiling from source

npm start

sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:242:13
module.js:538
    throw err;
    ^
Error: Cannot find module '/home/pi/google-home-notification-gateway/node_modules/bcrypt/lib/binding/bcrypt_lib.node'

I'm determined

npm install bcrypt

That seemed to work.

npm start didn't fail!

I had to type in !adminpassword! several times but it eventually let me in.

starbuck93 avatar Mar 29 '18 15:03 starbuck93

Thank a lot for your determination ^^ and for sharing all these issues.

I'll try to reproduce and fix all these dependencies issues.

MarlBurroW avatar Mar 29 '18 15:03 MarlBurroW

Sure thing:

Raspberry Pi 3 B

Linux hassbian 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux

10:49:15 up 74 days, 36 min, 2 users, load average: 0.07, 0.08, 0.08

npm 5.5.1

node v8.9.3

I think I installed this image from the Home Assistant "Hassbian" a while ago, sorry I don't have more details on that bit.

Maybe there's a few more details in the first debug log I shared in the beginning.

starbuck93 avatar Mar 29 '18 15:03 starbuck93