Hot swap of local Meteor package - meteor

I am using local Meteor package for my app (not posted on Atmosphere.js).
When I update this package elsewhere, I proceed with the following:
Update version of the package.
Delete old package from /packages/ directory of the live app.
See my program search for packages 3(?) times and then crash:
Your app is crashing. Here's the latest log:
Errors prevented startup:
While selecting package versions:
error: unknown package in top-level dependencies: vladimir3000:testpack
Your application has errors. Waiting for file change.
Copy new package with new version.
See my app picking up the changes and going live again:
vladimir3000:testpack upgraded from 0.0.2 to 0.0.3
=>Meteor server restarted
Is there a way to avoid step 3 and more elegantly instruct meteor to replace one package with another. Meteor update would not work as the package is not on atmosphere.js. Or hot swap is something from SOA world not from blood and fibers of Meteor javascript?

You can simply paste over the files for the package.
When you delete the old package, Meteor sees a file change and rebuilds the app. Since the package no longer exists in the packages directory, Meteor will try to pull it down from Atmosphere since it sees that there is a dependency on vladimir3000:testpack in .meteor/packages.
It will attempt to resolve this dependency a few times, with each build failing because the package you are referencing is unknown.
You can stop meteor and delete and replace the folder. Or you can copy and paste over the folder. The second method is preferable because Meteor will simply rebuild with all of the new files, rather than rebuilding and trying to resolve the dependency using Atmosphere.

Related

Force Swift Package Manager to honour Package.resolved

I am trying to use Swift Package manager to update my dependencies locally to match those in the Package.resolved file.
For example, when I update my dependencies I run swift package update, which updates the Package.resolved file, which I then commit. When I pull this new commit on to a computer that has an existing .build directory with the old versions of the dependencies I would like to update the local versions to the one in Package.resolved.
I was expecting swift package resolve to do this, but instead it updates the Package.resolved according to the .build/dependencies-state.json.
The obvious solution is to delete the .build directory, but this means the dependencies are recompiled every time, which can be slow on CI.
I want the equivalent of bundle install, yarn install, or carthage boostrap. Is this possible?
This has been confirmed to be a bug, and I have opened a bug in the Swift JIRA.

How to Disable download missing package each time in meteor?

I tried to create meteor web application, but meteor download missing package each time when I change my code, and it was unnecessary.
So, can I config it only runs at the first time?
Thanks!
Could you add the actual message on the package it tries to download? Anyway, there are two potential locations where meteor looks for packages that need to be installed.
This is which each Meteor application and it's using Meteor Atmosphere packages. You can find these at .meteor folder in your project root file called packages path ./meteor/packages
Other potential place is packages.json in project root. It exists if you have used npm install or meteor npm install within the project.
Deleting unnecessary packages from these files should do the trick.

check is not defined in meteor.js

I am new to meteor, I was trying to use file upload using
tomitrescak/meteor-uploads
I successfully uploaded some file, but when I tried to delete the uploaded file, I got error in my terminal Reference Error:check is not defined
I have checked the documentation and searched the web regarding this error but could not find any solution for this.
Note: I got similar error while studing http://meteortips.com/second-meteor-tutorial/iron-router-part-1/
OS: Ubuntu 14.04
meteor: 1.2.1
TL;DR
$ meteor add check
Longer version
In Meteor version prior to v1.2, a core package called meteor-platform used to export some symbols, including check.
Since v1.2, this is no longer the case and those symbols are no longer available via the platform, but using dedicated packages instead.
It is likely that one of the packages that you are using (or your app code itself) is using check (probably in one of its methods) without declaring it as a dependency.
Until the package maintainers update the dependency, you should be able to overcome the error by adding check as a top-level dependency:
$ meteor add check
If you identify which package is causing the issue, you can report it on GitHub, or fork the package yourself, add the missing dependencies and submit a pull-request.

How to re-use an already installed package in Meteor?

I installed couple of packages for 'Project A' (e.g bootstrap) assuming that it will be available for all subsequent projects. But when a new meteor project 'Project B' was created, meteor list showed only default packages. So my assumption that meteor packages are like ruby gems available globally is incorrect. As I work offline every now and then, Is there a way I can manually copy/re-use installed packages?
Yes they are similar to gems. Packages are installed in ~/.meteor/packages, in precompiled form. They can be installed globally this way.
When you add a package to your project it will essentially copy the package from there into your build-cache directory hidden in the .meteor directory of your project.
To install a package locally where you can easily re-use it you would have to clone the github repository of the package and place the output in the /packages directory of your Meteor app.
For example for bootstrap, twbs:bootstrap you would clone this reposistory: https://github.com/twbs/bootstrap, into a directory like /packages/twbs:bootstrap (name doesn't matter if its defined in the package.js file on the repository.
In general you can easily re-use a package without the hassle of adding it in manually like so. It's better to use the global packages which are kept up to date.
The trouble comes with being offline. If you use a local package its nearly guaranteed to always work. Whereas the global ones can give a bit of trouble once in a while when you try to add a package in as meteor tries to check the package is up to date, especially where npm packages are involved with the package.
To keep it short if you added a package in using meteor add twbs:bootstrap you should most likely be able to add it to another project using the same command. Only if you keep your packages & meteor up to date.

Error while installing natural node in meteor project

I am working on a meteor project. Have to use natural package for natural language facility. I installed that using 'npm install natural'. But when ran the project, got error as 'ReferenceError: require is not defined'.
Added this line: var abc=Meteor.require('natural'); in the file in which have to use it. But when I am running the project, it is showing error as:=> Started proxy.
=> Meteor 0.8.1.3 is available. Update this project with 'meteor update'.
=> Started MongoDB.
=> Errors prevented startup:
While building package `router`:
error: no such package: 'page-js-ie-support'
error: no such package: 'HTML5-History-API'
-- When tried to install the above listed missing packages, showing error as:
smart.json changed.. installing from smart.json, I got the following error after successfully installing various packages like natural, iron-router, paginated-subscription, router, accounts-ui-bootstrap-dropdown, spin. But after that showing following error. Why so?
/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:106
throw('Could not locate package.js within path ' + self.source.packagePa
^
Could not locate package.js within path /home/priya/.meteorite/packages/natural/NaturalNode/natural/d541ca394659521498ed36a7f6e03fef93163e53
-- The packages in my project are: I don't understand here as router package is already listed then why showing error while running the project.??
meteor list --using
standard-app-packages
bootstrap
router
accounts-ui-bootstrap-dropdown
accounts-password
spin
paginated-subscription
email
insecure
iron-router
npm
Please guide me in this direction. This error is becoming a recursive kind of error. Have broke my head in this problem but still stuck. Thanks in advance
You have a package called Natural (not sure which) which isn't built to the correct packages specifications or has been modified somehow.
This can't be fixed that easily, you would have to contact the author of the package to fix it or modify it yourself. I can't find NaturalNode on atmosphere so its likely a custom package.
You might want to make the rest of your app work to debug fixing it though. To do that you need to remove this package
Remove the files and folders in ~/.meteorite/packages
Look through your packages smart.json and remove the offending package (natural). and run mrt update. And remove the rest of the code in your app relating to natural that might stop your app booting up.
From what it looks like you've cloned https://github.com/NaturalNode/natural into meteorite somehow. You would have to look at how to build a package for meteor.
The files you have used are an npm module and don't just work with meteor if you copy the files in. You have to make a compatible meteorite package for it to work. Or use meteor-npm to use the npm module in your app directly.
This project may also help you get started as an example of how to make a wrapper for an npm module to use with meteor

Resources