Smithsonian / dpo-cook

DPO Cook - 3D Model/Geometry/Texture Processing Server
Apache License 2.0
71 stars 8 forks source link

npm Build Issue #27

Closed WilliamSokolErhard closed 4 years ago

WilliamSokolErhard commented 4 years ago

On a clean install I get the following error when I try to build the program:

 J:\dpo-cook> npm run build

> dpo-cook@1.0.0 build J:\dpo-cook
> concurrently "npm run build-server" "npm run build-client"

[0]
[0] > dpo-cook@1.0.0 build-server J:\dpo-cook
[0] > tsc -b source/server
[0]
[1]
[1] > dpo-cook@1.0.0 build-client J:\dpo-cook
[1] > cd source/client && webpack && cd ../..
[1]
[1] J:\dpo-cook\node_modules\webpack-cli\bin\cli.js:93
[1]                             throw err;
[1]                             ^
[1]
[1] TypeError: Cannot convert undefined or null to object
[1]     at Function.keys (<anonymous>)
[1]     at Object.<anonymous> (J:\dpo-cook\source\client\webpack.config.js:39:22)
[1]     at Module._compile (J:\dpo-cook\node_modules\webpack-cli\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
[1]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
[1]     at Module.load (internal/modules/cjs/loader.js:977:32)
[1]     at Function.Module._load (internal/modules/cjs/loader.js:877:14)
[1]     at Module.require (internal/modules/cjs/loader.js:1019:19)
[1]     at require (J:\dpo-cook\node_modules\webpack-cli\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
[1]     at WEBPACK_OPTIONS (J:\dpo-cook\node_modules\webpack-cli\bin\utils\convert-argv.js:114:13)
[1]     at requireConfig (J:\dpo-cook\node_modules\webpack-cli\bin\utils\convert-argv.js:116:6)
[1]     at J:\dpo-cook\node_modules\webpack-cli\bin\utils\convert-argv.js:123:17
[1]     at Array.forEach (<anonymous>)
[1]     at module.exports (J:\dpo-cook\node_modules\webpack-cli\bin\utils\convert-argv.js:121:15)
[1]     at J:\dpo-cook\node_modules\webpack-cli\bin\cli.js:71:45
[1]     at Object.parse (J:\dpo-cook\node_modules\webpack-cli\node_modules\yargs\yargs.js:567:18)
[1]     at J:\dpo-cook\node_modules\webpack-cli\bin\cli.js:49:8
[1]     at Object.<anonymous> (J:\dpo-cook\node_modules\webpack-cli\bin\cli.js:366:3)
[1]     at Module._compile (internal/modules/cjs/loader.js:1133:30)
[1]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
[1]     at Module.load (internal/modules/cjs/loader.js:977:32)
[1]     at Function.Module._load (internal/modules/cjs/loader.js:877:14)
[1]     at Module.require (internal/modules/cjs/loader.js:1019:19)
[1]     at require (internal/modules/cjs/helpers.js:77:18)
[1]     at Object.<anonymous> (J:\dpo-cook\node_modules\webpack\bin\webpack.js:156:2)
[1]     at Module._compile (internal/modules/cjs/loader.js:1133:30)
[1]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
[1]     at Module.load (internal/modules/cjs/loader.js:977:32)
[1]     at Function.Module._load (internal/modules/cjs/loader.js:877:14)
[1]     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
[1]     at internal/main/run_main_module.js:18:47
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! errno 1
[1] npm ERR! dpo-cook@1.0.0 build-client: `cd source/client && webpack && cd ../..`
npm ERR! Exit status 1
[1] npm ERR!
[1] npm ERR! Failed at the dpo-cook@1.0.0 build-client script.

I tried resetting and installing npm over again to no avail. I'm probably missing something obvious but I would appreciate any help.

Thanks in advance.

gjcope commented 4 years ago

What OS are you using?

WilliamSokolErhard commented 4 years ago

Windows 10 pro

gjcope commented 4 years ago

Could be a dependency issue. Have you tried npm ci?

WilliamSokolErhard commented 4 years ago

Yeah, I tried that: https://docs.npmjs.com/cli/ci.html I tried with admin and I still get the same error.

It definitely seems like an issue with that node_modules\webpack-cli dependency but I can't seem to fix it.

I tried one of the old releases and got a similar issue.

gjcope commented 4 years ago

I was able to recreate it, thanks. Am investigating now.

gjcope commented 4 years ago

The main issue is that our documentation didn't update correctly... there is a .env file in source/client that needs to be created based on the template. Working on making this more user friendly and updating the documentation but if you create that .env you should be good.

WilliamSokolErhard commented 4 years ago

Thank you so much. I just tried it on another PC with the same issue. I will now try with the .env

WilliamSokolErhard commented 4 years ago

It seems to have built more but I'm still getting an error:

[1] npm run build-client exited with code 0
[0] libs/ff-react/source/ManipTarget.tsx(10,73): error TS2307: Cannot find module '@ff/browser/ManipTarget'.
[0] libs/ff-react/source/OrbitManip.ts(10,72): error TS2307: Cannot find module '@ff/browser/ManipTarget'.
[0] npm ERR! code ELIFECYCLE
[0] npm ERR! errno 2
[0] npm ERR! dpo-cook@1.0.0 build-server: `tsc -b source/server`
[0] npm ERR! Exit status 2
[0] npm ERR!
[0] npm ERR! Failed at the dpo-cook@1.0.0 build-server script.
[0] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[0]
[0] npm ERR! A complete log of this run can be found in:

I will see if it is fatal or not.

gjcope commented 4 years ago

You may need to rebuild.

WilliamSokolErhard commented 4 years ago

Wow, it finally works. Thanks again for all your help. I think you guys are doing some great stuff with this project and in general.

gjcope commented 4 years ago

Thanks. I've added a default .env to the repo and will update the documentation so hopefully this won't happen again. Please feel free to contribute or submit additional bugs you may find.

WilliamSokolErhard commented 4 years ago

Sorry, now I'm getting some issue with the jsonLoader: It happens when I try to start the server after it successfully builds. npm run server or npm run watch

-------------------------
Cook 3D Processing Server
-------------------------

Clients loaded: 2

J:\dpo-cook\source\server\utils\jsonLoader.ts:69
    return validate(filePath);
           ^
Error: failed to parse 'J:\dpo-cook\server\tools.json': Unexpected token "
    at J:\dpo-cook\source\server\utils\jsonLoader.ts:53:19
    at Object.validate (J:\dpo-cook\source\server\utils\jsonLoader.ts:69:12)
    at new TaskManager (J:\dpo-cook\source\server\app\TaskManager.ts:47:46)
    at new JobManager (J:\dpo-cook\source\server\app\JobManager.ts:139:28)
    at new ProcessingServer (J:\dpo-cook\source\server\app\ProcessingServer.ts:78:27)
    at Object.<anonymous> (J:\dpo-cook\source\server\index.ts:41:16)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
gjcope commented 4 years ago

looks like an error with your tools.json file. Did you configure it per the build instructions? If so, you can try a json validator or paste it here and I can take a look.

WilliamSokolErhard commented 4 years ago

I might have tried to add blender in there.

That fixed it, thanks yet again.

gjcope commented 4 years ago

You should be able to add Blender, we have it in our configuration locally. Maybe it was a bad path?

It should be something like: "Blender": { "executable": "C:\Program Files\Blender Foundation\Blender\Blender.exe", "version": "2.80", "maxInstances": 1, "timeout": 3600 // 1 hour },

gjcope commented 4 years ago

Ack. GH took out the escaped backslashes. Lets try again:

"Blender": { "executable": "C:\\Program Files\\Blender Foundation\\Blender\\Blender.exe", "version": "2.80", "maxInstances": 1, "timeout": 3600 // 1 hour },

WilliamSokolErhard commented 4 years ago

It was definitely a bad path. All my bad.

Anyways, I'm trying to implement the rest API and I'm having a little difficulty. Could you please let me know whether I'm supposed to replace the "mymesh.obj" with a byte array of the 3d model I'm sending or do I send it as a HTTP PUT? Is there a different way I'm supposed to get the file on the server?

{
  "id": "7fa4db4c-4cd7-44d7-b37d-937cdada1663",
  "name": "Decimate mesh",
  "clientId": "e201f3b6-9d2d-4f13-822a-11c65341a250",
  "recipeId": "be8c1ebc-3b2c-4cef-bd9a-14782624c931",
  "parameters": {
    "highPolyMeshFile": "mymesh.obj",
    "numFaces": 150000
  },
  "priority": "normal",
  "submission": "2018-08-27T16:33:45.853Z"
}

Thanks again.

gjcope commented 4 years ago

That looks correct to me but you may want to try the full path. Most of the recipes include a pickup task that will handle the file transfer. Take a look at: source/server/tasks/PickupTask.ts

Have you tried the web ui or are you interested in creating your own? It has a nice drag and drop feature for setting the file parameters.

WilliamSokolErhard commented 4 years ago

I'm trying to integrate it into a standalone application. Specifically a unity app with unity webrequests.

I'm feeding in this exact string now and getting a 405 error.

    "id":"7fa4db4c-4cd7-44d7-b37d-937cdada1663",
    "name":"Decimate mesh",
    "clientId":"6867a59e-0ec5-411d-a93e-4f8cd9098823",
    "recipeId":"7ce5c5b1-00d2-4d7f-bebc-ea99ae5f6640",
    "parameters":{
        "highPolyMeshFile":"J:/Cook Demo/Assets/StreamingAssets/test.FBX",
        "numFaces":13245
    },
    "priority":"normal",
    "submission":"2018-08-27T16:33:45.853Z"
}

In return:


] POST / 405 - - 17.448 ms
[2] WEBDAV POST / 405 Method Not Allowed
[2] PUT / 405 - - 0.784 ms
[2] WEBDAV PUT / 405 Method Not Allowed
``
WilliamSokolErhard commented 4 years ago

I got it.

In the Swagger Doc it says

"POST ​/job"

I needed to put in "http://127.0.0.1:8000/job" as the address.

gjcope commented 4 years ago

Great, thanks for the update! Please let us know what you think and we welcome any contributions.