Not sure who “you” is in this context. If you’d like to help improve the project, great, but let’s not point fingers. It’s a community project and I am a member of the community. Many folks use Meteor (and TypeScript) on Windows, so there could be a problem with your implementation. Your help with improving anything you run into with is greatly appreciated.
There is no problem with the code that it transpiled it into. In fact, it makes a lot of sense. Let’s look at the import
:
import {Meteor} from "meteor/meteor";
This is ES6 code and depending on the engine which uses it needs to be compiled. Due to various differences in Node capabilities, this means transpiling to a different, compatible version of ECMAScript. During this process, this import
statement needs to be changed to CommonJS (the module system used in Node).
To explain why that code is transpiled that way, you’ll note that you are asking for the Meteor
named-export
from the meteor/meteor
package. This equates to require("meteor/meteor").Meteor
in the CommonJS format, which is exactly what the code that you provided is doing, albeit with different variable names and a slightly more re-usable format.
No, it does exist, but you may be using it incorrectly. Hard to say though as you didn’t include an error.
Though before you suggest that you are using it correctly, I’ll point out that I don’t see a lot of reasons why using Meteor.user()
in the global scope like that would be what you want. At that level, it would be evaluated during initialization – meaning, before there is actually any chance of a user, or in the case of the server, outside of an authenticated method/publication, etc. Have you tried using it inside a context where there would be a user?
I would recommend trying to run something like the Todos app to see how it is intended to work. By starting with a template, you’ll gain some understanding of where it’s expected to work and I think you’ll find that it works properly.
The system cannot find the required path
This issue has shown up before but I haven’t received reproduction steps which work. See this issue here. If you’re getting this error it means that the meteor
command, which is outside of your app directory is missing or is no longer in your PATH
.
I’m aware. And this probably explains what has happened. In case it’s not obvious, that is an extremely dangerous command, especially on Windows. You are saying “forcefully and recursively delete directories and ignore all previously ignored files”. You might be interested in this issue which outlines how git clean
follows junctions and deletes their contents (though that’s not too surprising, as that’s exactly what Microsoft says would happen on commands which work recursively).
Within your app, there are various junctions (hard-links) to global installations, one of the most important being the .meteor/local/dev_bundle
link. This ensures that your app matches the correct version of Meteor on your system, allows multiple versions of Meteor to co-exist without needing (large) meteor-tool
installations for every app that you create. It also allows the meteor npm
and meteor node
commands to work on the proper versions of node
binaries without relying on what could be a cluttered global installation (and likely not the correct version).
Normally, you wouldn’t have this problem because Meteor creates the proper .gitignore
rule that prevents .meteor/local/dev_bundle
from being included in git
commands, but by adding the -x
you’ve told git
to ignore that. I would recommend not using the -x
flag, or if you do use it, to add the -i
flag to do any deletions interactively with prompts before deletion.
In all likeliness, you’ve probably deleted the meteor.bat
command from %localappdata%/.meteor/packages/meteor-tool/1.4.2_3/mt-os.windows.x86_32/dev_bundle
, leaving your installation broken. Imagine if you had a junction to the root of your drive!
Whew, that got long! I hope this helps to explain. I can see how this might be confusing (and painful!), but if you know of a way to prevent this, that would be great! Ultimately though, it’s probably not correct to be using git clean -x
.