Issues when upgrading to 0.6.0
See original GitHub issueWhen I upgraded sandstone to 0.6.0 in my project, I got this error message.
console error message
> npx ts-node index.tsError: Cannot define namespace under a base path.
at BasePathClass.getName (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\src_internals\datapack\BasePath.ts:49:13)
at Object.BasePathClass.MCFunction (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\src_internals\datapack\BasePath.ts:137:64)
at Object.<anonymous> (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\index.ts:27:1)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Module.m._compile (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\node_modules\ts-node\src\index.ts:1043:23)
at Module._extensions…js (internal/modules/cjs/loader.js:1158:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\node_modules\ts-node\src\index.ts:1046:12)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! manhunt@1.0.0 build: npx ts-node index.ts
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the manhunt@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Beatso\AppData\Roaming\npm-cache_logs\2020-11-29T13_33_24_088Z-debug.log
After replacing all mcfunction
s with MCFunction
, i got this error:
console error message
> npx ts-node index.tsC:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\node_modules\ts-node\src\index.ts:500 return new TSError(diagnosticText, diagnosticCodes) ^ TSError: ⨯ Unable to compile TypeScript: index.ts:2:22 - error TS2305: Module ‘“./node_modules/sandstone/core”’ has no exported member ‘saveDatapack’.
2 import { MCFunction, saveDatapack } from “sandstone/core” ~~~~~~~~~~~~
at createTSError (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\node_modules\ts-node\src\index.ts:500:12)
at reportTSError (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\node_modules\ts-node\src\index.ts:504:19)
at getOutput (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\node_modules\ts-node\src\index.ts:739:36)
at Object.compile (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\node_modules\ts-node\src\index.ts:955:32)
at Module.m._compile (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\node_modules\ts-node\src\index.ts:1043:43)
at Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\Beatso\OneDrive\Documents\Minecraft\datapacks\SurvivalistsVsHitmen\node_modules\ts-node\src\index.ts:1046:12)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! manhunt@1.0.0 build: npx ts-node index.ts
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the manhunt@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Beatso\AppData\Roaming\npm-cache_logs\2020-11-29T13_34_49_146Z-debug.log
what am I doing wrong, and how can I fix this issue? is this an issue with the release of sandstone, or what I’m doing? link to my code
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
So the bug is fixed? Perfect!
I’m happy to hear it, thanks 🙂 Once the documentation is over, I’ll officially release it & I hope it will get some traction!
Once again, feel free to contact me on Discord if you need to. I’ll close this issue for now, have a nice week!
Hello,
Indeed, Sandstone v0.6.0 changed a lot of things. This isn’t documented yet (sorry for that), but to use Sandstone v0.6.0 you will probably want to create a whole new project (don’t worry, the code stays identical, but the structure of the project changed).
Basically, Sandstone v0.6.0 introduces a CLI, which helps to create/build/watch projects. This is a beta CLI for the moment, and is not battle-tested. It adds support for a configuration file, automatic saving, automatic import of your files etc…
Therefore, you have 2 options:
If you want to stay on the “manual” one, you will need to import
savePack
instead ofsaveDatapack
. This change is to be future-proof, since Sandstone will probably support resource packs in the long run. You also need to upgrade to Sandstone v0.6.2, which fixes the BasePath-related bug (thanks for letting me know btw, you’re the first to report this bug!)If you want to upgrade to the CLI, you’ll have to create a new project. You will get automatic saving, neat configurations, and a nice CLI that is way better than running
ts-node index.ts
! Here are the steps:projects
. A sub folder will be created for your Sandstone project.npx sandstone-cli create my-project-name
. Change my-project-name to your project’s name: it will not be the name of the data pack, just the name of the folder, so don’t worryTo build, you can run
npm run build
. To build & rebuild on each change, you can runnpm run watch
. Once again, it’s a very beta CLI, so expect a few bug. Report them & I’ll fix them as soon as possible!I’ll keep this issue opened for a bit if you’ve got any problem, then I’ll close it. I’m interested in getting your feedback on Sandstone btw: add me on Discord (TheMrZZ#9307), or drop by the Minecraft Commands Discord and tag me if you want!