Closed zackhall closed 8 years ago
Simplifying this a bit, I added the line directly to the package.json
. So the updated package.json
file reads:
{
...
"scripts": {
"start:local": "manifoldjs http://localhost:3000/ -d tmp\\local\\ -p windows10 -l info"
},
...
"devDependencies": {
...
"manifoldjs": "^0.5.1",
...
},
}
I still see the same issue. But running that command directly doesn't hit any issues.
Moreover, I can verify the node_modules\manifoldjs-windows10\
folder is present.
This sounds similar to help me test with Visual Studio code. In that scenario, we don't call the bianary E. Instead we call them the JS file directly. Have you tried that? and then I know when we run it on the server we actually have endpoints her exposed but we do not have one for building the APPX
This is what we put on top of it for the server: https://github.com/manifoldjs/manifold-api/tree/master/src/services this lets us call in. There is no endpoint for the build of appx, but that shouldn't be hard to add. I don't know if this is the right way to go or wheatear you should just run it from the top (doing just windows10 and then packaging it should be really quick). Do you want to set up a call to talk about?
Hi, @boyofgreen. Sorry for the delay. I've been out a couple of days. I'd love to set up a call to chat about it.
The goal is to set up a starter pack repo to help anyone quickly build a Hosted Web App. The package.json would have some scripts similar to above to make it much quicker to generate/launch the app packages for local/prod so that they don't have to type out the full command each time.
I'd love to chat with you about it!
Hi @zackhall
The approach suggested by @boyofgreen seems more appropriate for you scenario. Also, starting with the latest release, we moved most of the core code into a separate library so I would recommend taking a dependency on manifoldjs-lib rather than manifoldjs.
Nevertheless, I think the problem you currently have could be fixed if you replace the implementation of getPackageInformation in manifoldjs-lib/lib/packageTools.js with the following code. It would be very helpful to know if this solves the problem so that we might consider including this change in the next release.
function getPackageInformation (packageName) {
try {
var packagePath = path.dirname(require.main.filename);
var modulesPath = path.join(packagePath, node_modules);
try { fs.statSync(modulesPath).isDirectory() }
catch (er) {
modulesPath = path.resolve(packagePath, '..');
}
if (packageName) {
packagePath = path.join(modulesPath, packageName);
}
packagePath = path.join(packagePath, packageJson);
return require(packagePath);
}
catch (err) {
throw new Error('Error retrieving information for module: \'' + (packageName || 'main') + '\'.');
}
}
Patching my manifoldjs-lib package in /node_modules/ locally with @f2bo's code above resolved the issue for me. This allows me to run the CLI from an npm script.
@zackhall This fix is already part of the v0.5.2 release that we published today.
I'm trying to create a script that creates a project with manifold and then runs it immediately.
The node script does something like this:
When running straight from a command prompt like
node script.js
it runs okay. If I try to put it in an npm script like:I get the following error:
Is there any guidance on using this from an npm script?