plouc / mozaik-demo

Sample mozaïk app with two dashboards
http://mozaik.rocks/
103 stars 75 forks source link

Failed at the mozaik-dashboard@ postinstall script error when running npm install #8

Closed ruionwriting closed 7 years ago

ruionwriting commented 8 years ago
item info notes
node version v4.4.3 output from node --version
npm version 3.9.5 output from npm --version
mozaik-demo version git@github.com:ruionwriting/mozaik-demo.git git ref of the demo
browser browser used, applyable if the issue is not related to the client

Expected behavior

Run npm install with no errors to be able to build.

Actual behavior

Fails with the following error:

$ npm install
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130

> mozaik-dashboard@ postinstall C:\users\rui.marques\Documents\GitHub\mozaik-demo
> if $BUILD_ASSETS; then npm run build-assets; fi

then was unexpected at this time.

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\rui.marques\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.4.3
npm ERR! npm  v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! mozaik-dashboard@ postinstall: `if $BUILD_ASSETS; then npm run build-assets; fi`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mozaik-dashboard@ postinstall script 'if $BUILD_ASSETS; then npm run build-assets; fi'.
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 mozaik-dashboard package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     if $BUILD_ASSETS; then npm run build-assets; fi
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs mozaik-dashboard
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls mozaik-dashboard
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\users\rui.marques\Documents\GitHub\mozaik-demo\npm-debug.log

Steps to reproduce

Run npm install.

zufanka commented 7 years ago

same issue (node 4.6.1 , npm 2.15.9)

plouc commented 7 years ago

Mozaïk requires npm@3, let me know if it solve the problem

zufanka commented 7 years ago

yes it did, thanks! I could proceed in the installation. Only now when I try to run the app I get

mozaik-demo ♥ node app.js 
info: registered API 'mozaik' (mode: poll)
info: registered API 'github' (mode: poll)
info: registered API 'travis' (mode: poll)
error: weather.apiToken: must be of type String
gmarab commented 7 years ago

same issue here (node 4.6.1 , npm 3.10.9)

the same error even with: (node 6.9.2, npm 3.10.9)

plouc commented 7 years ago

@zufanka, @gmarab, the weather extension requires a token to be functionnal, see https://github.com/plouc/mozaik-ext-weather. When I first started the extension, it was not the case, it's quite annoying now, I'll probably remove it from the demo.

plouc commented 7 years ago

And the openweathermap doc: https://openweathermap.org/appid

plouc commented 7 years ago

if you don't want to create an account, you can remove the extension from the demo, you'll have to edit https://github.com/plouc/mozaik-demo/blob/master/src/App.jsx, https://github.com/plouc/mozaik-demo/blob/master/src/server.js and https://github.com/plouc/mozaik-demo/blob/master/config.js, just remove all references to mozaik-ext-weather

gmarab commented 7 years ago

Sorry @plouc, I meant that I have the same problem as @ruionwriting, the one that opened the thread. I get the error during install npm

plouc commented 7 years ago

@gmarab, unfortunately, I don't have a window VM now, but only the post install failed, you should be able to build the assets by just running npm run build, which is the postinstall action.

gmarab commented 7 years ago

Thank you @plouc , using npm run build-assets now works.

danbars commented 7 years ago

+1 for removing ext-weather from the demo project. It causes the demo to fail out of the box, and there are enough other example widgets without it.

Easyman123 commented 7 years ago

Hi there,

I faced the same problem as @zufanka being unable to run the app and receiving the following error: 'weather.apiToken: must be of type String' when trying to build the demo dashboard. Even replacing the 'xxxxx' from the WEATHER_API_TOKEN in the .env file by the API key (APPID) which is generated by openweathermap.org (you need to create an account + sign in to get the API-key) didnt help. The mozaik-demo was still not working @plouc .

So what I did and what solved it was simply setting the default value of the apiToken in the config.js file from null to the API key (APPID) that is generated by openweathermap. You can find the config.js file in the source-folder which is located in the following directory: mozaik-demo -> node_modules -> mozaik-ext-weather -> src -> config.js In that config.js you need to change the default value of the apiToken from null into the API key and after doing that everything worked as expected.

Hope that helps

plouc commented 7 years ago

mozaik-ext-weather removed by https://github.com/plouc/mozaik-demo/commit/f070085bef61090d593291aaee90ff886c0e684f

zack319 commented 7 years ago

you have to run the command: npm run build-assets