Closed RaananW closed 1 year ago
I'm gettting an error from the "npm start" step, when following the instructions in the README:
eoin@eoinlz40~/code/havok/packages/demo $ npm install
added 395 packages, and audited 397 packages in 4s
54 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
eoin@eoinlz40~/code/havok/packages/demo $ npm start
> @babylonjs/havok-demo@1.0.0 start
> npx webpack serve --config ./webpack.dev.js
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/
<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.0.35:8080/
<i> [webpack-dev-server] On Your Network (IPv6): http://[fe80::9398:a124:7be0:49f5]:8080/
<i> [webpack-dev-server] Content not from webpack is served from '/home/eoin/code/havok/packages/demo/public' directory
<i> [webpack-dev-middleware] wait until bundle finished: /
asset js/havokBundle.js 11.9 MiB [emitted] (name: main)
asset index.html 585 bytes [emitted]
runtime modules 27.4 KiB 12 modules
modules by path ../../node_modules/@babylonjs/core/ 3.14 MiB 253 modules
modules by path ../../node_modules/webpack-dev-server/client/ 71.8 KiB 16 modules
modules by path ../../node_modules/webpack/hot/*.js 5.3 KiB
../../node_modules/webpack/hot/dev-server.js 1.94 KiB [built] [code generated]
+ 3 modules
modules by path ../../node_modules/html-entities/lib/*.js 81.8 KiB
../../node_modules/html-entities/lib/index.js 7.91 KiB [built] [code generated]
../../node_modules/html-entities/lib/named-references.js 73 KiB [built] [code generated]
+ 2 modules
modules by path ./src/*.ts 3.07 KiB
./src/index.ts 756 bytes [built] [code generated]
./src/createScene.ts 2.33 KiB [built] [code generated] [1 error]
../../node_modules/ansi-html-community/index.js 4.16 KiB [built] [code generated]
../../node_modules/events/events.js 14.5 KiB [built] [code generated]
ERROR in ./src/createScene.ts 6:0-44
Module not found: Error: Can't resolve '@babylonjs/havok' in '/home/eoin/code/havok/packages/demo/src'
resolve '@babylonjs/havok' in '/home/eoin/code/havok/packages/demo/src'
Parsed request is a module
using description file: /home/eoin/code/havok/packages/demo/package.json (relative path: ./src)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/home/eoin/code/havok/packages/demo/src/node_modules doesn't exist or is not a directory
/home/eoin/code/havok/packages/demo/node_modules doesn't exist or is not a directory
/home/eoin/code/havok/packages/node_modules doesn't exist or is not a directory
looking for modules in /home/eoin/code/havok/node_modules
single file module
using description file: /home/eoin/code/havok/package.json (relative path: ./node_modules/@babylonjs/havok)
no extension
Field 'browser' doesn't contain a valid alias configuration
/home/eoin/code/havok/node_modules/@babylonjs/havok doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
/home/eoin/code/havok/node_modules/@babylonjs/havok.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/home/eoin/code/havok/node_modules/@babylonjs/havok.js doesn't exist
/home/eoin/code/havok/node_modules/@babylonjs/havok doesn't exist
/home/eoin/code/node_modules doesn't exist or is not a directory
/home/eoin/node_modules doesn't exist or is not a directory
/home/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
@ ./src/index.ts 2:0-44 9:24-35
ERROR in /home/eoin/code/havok/packages/demo/src/createScene.ts
./src/createScene.ts 7:25-43
[tsl] ERROR in /home/eoin/code/havok/packages/demo/src/createScene.ts(7,26)
TS2307: Cannot find module '@babylonjs/havok' or its corresponding type declarations.
ts-loader-default_e3b0c44298fc1c14
@ ./src/index.ts 2:0-44 9:24-35
webpack 5.88.1 compiled with 2 errors in 3927 ms
what npm version are you using? node version? just want to make sure workspaces work as expected
I've got:
eoin@eoinlz40~/code/havok/packages/demo $ npm -v
8.19.1
eoin@eoinlz40~/code/havok/packages/demo $ node -v
v18.9.1
I don't have any particular reason for being on these versions - they were just what I've been using for everything else so far. Happy to switch versions if I should be on a different one.
Those should be perfectly fine. Let me check locally
I tested on node 18 and 20, seems to work locally so I need to find what's wrong. Can you try running the following in the main directory of the repo:
npm install
and then
npm run start -w @babylonjs/havok-demo
Will help me with debugging
Oh, it seems the "npm install" in the repo root did the trick! Now, both "npm run start -w @babylonjs/havok-demo" and "npm run start" in the demo dir both work.
i'll update the readme
Thanks! This is gonna save a huge amount of time :)
Trying to figure out how to get it to reference a local Babylon build (which has caused me difficulties before) and I can't work it out. What I've done:
Have done some set of magic invocations in the Babylon.JS repo (can't remember what these were, exactly, but whatever it was, it works for some other similar "demo" projects I have)
I've edited the demo/package.json to reference my Babylon.JS build: "@babylonjs/core": "file:/home/eoin/code/Babylon.js/packages/dev/core/dist",
I've run npm link @babylonjs/core
But it still seems to be running the "vanilla" Babylon version from NPM, rather than my locally-modified one.
The next step is a simple way of using Babylon's server from the main repo. i'll add that in a future PR.
This PR is a suggestion for a way to test the repository using the @babylonjs/core package.
The @babylonjs/core package can either be linked from the main repository (if you make changes in the core lib). Otherwise it will use the current version (installed is 6.10.0). The code in createScene.ts can be used to test new functionality.
After this will be merged we can also add a proejct that is closer to the playground that will either use the babylon CDN ot the local babylon server (localhost:1337) to simplify making changes in both repositories using UMD.