Brewskey / spark-server

An API compatible open source server for interacting with devices speaking the spark-protocol
https://www.particle.io/
GNU Affero General Public License v3.0
54 stars 27 forks source link

Cannot find module... settings.json #261

Closed bradfernandez closed 6 years ago

bradfernandez commented 6 years ago

Server crashes when launched. This is a new install to a new windows machine using debian on the windows subsystem for Linux. Error log is below. Any help is appreciated.

ab@DESKTOP-2CQI7N7:~/spark-server$ npm start

spark-server@0.1.1 start /home/ab/spark-server nodemon --exec babel-node ./src/main.js --watch src --watch ../spark-protocol/dist --ignore data | bunyan

[nodemon] 1.17.2 [nodemon] to restart at any time, enter rs [nodemon] watching: /home/ab/spark-server/src/*/ ../spark-protocol/dist [nodemon] starting babel-node ./src/main.js module.js:549 throw err; ^

Error: Cannot find module '../../third-party/settings.json' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/home/ab/spark-server/node_modules/spark-protocol/dist/lib/FirmwareManager.js:63:18) at Module._compile (module.js:652:30) at Module._extensions..js (module.js:663:10) at Object.require.extensions.(anonymous function) [as .js] (/home/ab/spark-server/node_modules/babel-register/lib/node.js:152:7) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/home/ab/spark-server/node_modules/spark-protocol/dist/server/DeviceServer.js:71:24) at Module._compile (module.js:652:30) at Module._extensions..js (module.js:663:10) at Object.require.extensions.(anonymous function) [as .js] (/home/ab/spark-server/node_modules/babel-register/lib/node.js:152:7) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/home/ab/spark-server/node_modules/spark-protocol/dist/index.js:24:21) at Module._compile (module.js:652:30) at Module._extensions..js (module.js:663:10) at Object.require.extensions.(anonymous function) [as .js] (/home/ab/spark-server/node_modules/babel-register/lib/node.js:152:7) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/home/ab/spark-server/src/defaultBindings.js:8:1) at Module._compile (module.js:652:30) at loader (/home/ab/spark-server/node_modules/babel-register/lib/node.js:144:5) [nodemon] app crashed - waiting for file changes before starting...

jlkalberer commented 6 years ago

@bradfernandez - try npm run update-firmware. That should pull down the files correctly

AntonPuko commented 6 years ago

@jlkalberer won't help. they change github username, and some patches in the repos, so our script doesn't work anymore. @bradfernandez I'll probably fix that tomorrow.

bradfernandez commented 6 years ago

Thank you very much. I appreciate the quick response. I'll check back tomorrow.

jlkalberer commented 6 years ago

@AntonPuko put out a fix. It should be working now.

AntonPuko commented 6 years ago

yep, you should pull the latest dev and reinstall dependencies.

bradfernandez commented 6 years ago

I deleted the spark-server folder and cloned the git repo at https://github.com/Brewskey/spark-server.git. then ran npm install from inside the new spark-server folder. When I run npm start, it crashes with the same error. What am I doing wrong?

AntonPuko commented 6 years ago

@bradfernandez You're doing all right. I forgot to rebuild spark-protocol at yestarday late night. :shy: Try again, it should finally work now.

bradfernandez commented 6 years ago

it works! Thank you so much for your help.

bradfernandez commented 6 years ago

Well this issue is back guys. I am trying to setup a new system and I'm getting this same error again.

AntonPuko commented 6 years ago

Just tried fresh installation. works for me. Do you have any warns/errors on npm i step?

bradfernandez commented 6 years ago

Ok i deleted spark-server. cloned the github repository. and reran sudo npm i. results below. When I run npm start I get the exact same crash and message as above.

pi@RobR_DVLP:~/spark-server $ sudo npm i npm WARN deprecated github@8.2.1: 'github' has been renamed to '@octokit/rest' (https://git.io/vNB11) npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated uglifyjs@2.4.11: uglifyjs is deprecated - use uglify-js instead. npm WARN deprecated babel-preset-latest@6.24.1: We're super 😸 excited that you're trying to use ES17+ syntax, but instead of making more yearly presets 😭 , Babel now has a better preset that we recmend you use instead: npm install babel-preset-env --save-dev. preset-env without options will compile ES2015+ down to ES5 just like using all the presets together and thus is more future proof. It also allows you to target specific browsers so that Babel can do less work and you can ship native ES2015+ to user 😎 ! We are also in the process of releasing v7, so please give http://babeljs.io/blog/17/09/12/planning-for-7.0 a read and help test it out in beta! Thanks so much for using Babel πŸ™, plse give us a follow on Twitter @babeljs for news on Babel, join slack.babeljs.io for discussion/development and help support the project at opencollective.com/babel npm WARN deprecated babel-preset-es2015@6.24.1: πŸ™Œ Thanks for using Babel: we recommend using babelreset-env now: please read babeljs.io/env to update! npm WARN deprecated babel-preset-es2015-node4@2.1.1: Use npmjs.org/babel-preset-env instead, see https://github.com/babel/babel-preset-env npm WARN deprecated babel-preset-es2016@6.24.1: πŸ™Œ Thanks for using Babel: we recommend using babelreset-env now: please read babeljs.io/env to update! npm WARN deprecated babel-preset-es2017@6.24.1: πŸ™Œ Thanks for using Babel: we recommend using babelreset-env now: please read babeljs.io/env to update! npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead

dtrace-provider@0.8.6 install /home/pi/spark-server/node_modules/dtrace-provider node-gyp rebuild || node suppress-error.js

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.13.1" gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/spark-server/node_modules/dtrace-provider/.node-gyp" make: Entering directory '/home/pi/spark-server/node_modules/dtrace-provider/build' TOUCH Release/obj.target/DTraceProviderStub.stamp make: Leaving directory '/home/pi/spark-server/node_modules/dtrace-provider/build'

pre-commit@1.2.2 install /home/pi/spark-server/node_modules/pre-commit node install.js

pre-commit: pre-commit: Failed to create the hook file in your .git/hooks folder because: pre-commit: EACCES: permission denied, open '/home/pi/spark-server/.git/hooks/pre-commit' pre-commit: The hook was not installed. pre-commit: pre-commit: pre-commit: chmod 0777 the pre-commit file in your .git/hooks folder because: pre-commit: ENOENT: no such file or directory, chmod '/home/pi/spark-server/.git/hooks/pre-commit' pre-commit:

spawn-sync@1.0.15 postinstall /home/pi/spark-server/node_modules/spawn-sync node postinstall

nodemon@1.17.2 postinstall /home/pi/spark-server/node_modules/nodemon node -e "console.log('\u001b[32mLove nodemon? You can now support the project via the open collective:\u001b[22m\u001b[39m\n > \u001b[96m\u001b[1mhttps://opencollective.com/nodemon/donate\u001b[0m\n')" || exit 0

Love nodemon? You can now support the project via the open collective:

https://opencollective.com/nodemon/donate

npm WARN lifecycle spark-server@0.1.1~postinstall: cannot run in wd %s %s (wd=%s) spark-server@0.1.1 update-firmware /home/pi/spark-server spark-server@0.1.1 /home/pi/spark-server β”œβ”€β”€ array-flatten@2.1.1 β”œβ”€β”¬ ava@0.17.0 β”‚ β”œβ”€β”€ arr-flatten@1.1.0 ....... └── uuid@3.2.1

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 fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

bradfernandez commented 6 years ago

After I run npm i I am not seeing the data or node_modules folders being created.

AntonPuko commented 6 years ago
npm WARN lifecycle spark-server@0.1.1~postinstall: cannot run in wd %s %s (wd=%s) spark-server@0.1.1 update-firmware /home/pi/spark-server

Spark-server postintstall fails with that warning, Im not sure what this warning exactly means. but according to your logs before, it can't get enough access to the filesystem.. Try to run npm run postinstall with sudo, or something like that.

AntonPuko commented 6 years ago

After I run npm i I am not seeing the data or node_modules folders being created. - so this definitely something with your rights to file system

bradfernandez commented 6 years ago

@AntonPuko Ok that worked. Very weird that it worked fine the first time but subsequent installs failed. I very much appreciate your help!

jlkalberer commented 6 years ago

Thanks @AntonPuko.

@bradfernandez - sorry about the issues. We pull down the system firmware from the Particle github to make OTA firmware updates a lot easier. They keep on changing the structure of their repos so things break around here

bradfernandez commented 6 years ago

@jlkalberer Not a problem I completely understand. I appreciate how attentive and helpful you and @AntonPuko have been.

bradfernandez commented 6 years ago

@jlkalberer @AntonPuko I am fairly new to this amazing programming thing and I have been very hesitant to open any issues or actually contribute to any projects because I didn't want to seem like a newb, but you guys have made this super easy and helpful. So I think from now on i'll be a lot less hesitant. Thank you!