Use apollo stack with meteor - meteor

i'm trying to use apollp stack with my meteor project. i used
meteor add apollo
meteor npm install --save apollo-client apollo-server express
to install apollo stack but when i execute meteor to run my project it gives errors
/home/xxxxxx/Example/crud/.meteor/local/build/programs/server/packages/modules.js:97872
const graphql_1 = require('graphql');
^^^^^
SyntaxError: Use of const in strict mode.
at/home/xxxxxx/Example/crud/.meteor/local/build/programs/server/boot.js:292:30
at Array.forEach (native)
at Function._.each._.forEach (/home/xxxxxxx/.meteor/packages/meteor-tool/.1.3.4_1.1wjluqr++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
Any ideas about what happened here ??

I'm trying to do the same thing. I think I can get you to the next step. Just add a couple of things to your npm install:
meteor npm install --save apollo-client apollo-server#^0.1.1 express graphql
I've put in a PR to add graphql to the npm install in the docs. Also, apollo-server has recently updated to 0.2, but meteor-integration is still working on it - the #^0.1.1 will not be needed when this is resolved. I'm still having some issues, so this may not get you all the way there, but it resolved this error for me.

Related

I am getting a require() of ES Module error using `npm install semantic-ui-dropdown` command

I just tried to install semantic-ui on two different machines and received the same error:
`npm ERR! Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/petelombardo/node_modules/del/index.js from /Users/xxx/node_modules/semantic-ui/tasks/clean.js not supported.
npm ERR! Instead change the require of index.js in /Users/xxx/node_modules/semantic-ui/tasks/clean.js to a dynamic import() which is available in all CommonJS modules.`
Please advise. Thank you.
results outlined in the video here.
The semantic ui repo hasnt been updated since 2018, it seems to be a dead project. There is a community fork called fomantic-ui, try using that instead, it doesnt have this issue as its still being maintained.

Cloud Functions for Firebase - functions.database.instance (and InstanceBuilder) not found

I'm trying to add listeners in my cloud functions to a second database instance according to the documentation here using:
exports.myHandler = functions.database.instance('foo').ref('bar')...
I am getting an error that the functions.database.instance() function doesn't exist. I have updated my functions using npm upgrade and firebase-functions specifically using npm install --save firebase-functions. I still don't see any reference to InstanceBuilder or functions.database.instance() in the source code. Has this functionality actually been released? Am I missing something?
I updated the dependencies in package.json to use the latest versions of firebase-admin and firebase-functions, and it's fixed.

Meteor can't run gcloud on server side

I'm building a small application that allows you to upload files, store them in the cloud and analyze them with Google Cloud Vision API.
I got the uploading and storing working now, I use firebase for that, but when I try to run gcloud I run into some issues.
In the main.js file in server folder I run:
import gcloud from 'gcloud';
console.log('gcloud', gcloud);
But that causes an error in the terminal:
=> Started proxy.
=> Started MongoDB.
Unable to resolve some modules:
"memcpy" in /C/Users/Zino/Documents/Meteor Projects/find-it/node_modules/bytebuffer/dist/ByteBufferNB.js
(os.windows.x86_32)
If you notice problems related to these missing modules, consider running:
meteor npm install --save memcpy
My site does not load so I run:
meteor npm install --save memcpy
But then I get an error I'n can't find anything about in the internet:
node error log
I've been been trying to solve this issue for 2 days now, without luck. Any suggestions?
In my case, this was fixed by installing + importing specific sub-packages of google-cloud, rather than the google-cloud metapackage, which includes everything.
e.g.
$ npm install --save #google-cloud/datastore
$ npm install --save #google-cloud/storage
var config = {
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
};
var datastore = require('#google-cloud/datastore')(config);
var storage = require('#google-cloud/storage')(config);
To expand on Windows being the culprit: The build fails at 'node-gyp configure build', which has a build dependency on Visual C++ Build Tools / Visual Studio 2015 and Python 2.7 on Windows. It can build on Windows, but is not as straightforward as building on a Unix-y system due to lack of a standard C++ toolchain. The Microsoft Node.js Guidelines for Windows, which make special mention of 'running into dreaded node-gyp issues', should have all the steps needed to get the build to work.

Meteor 1.3 node build: doesn't work anymore with React

With 1.2.*, I used to build my staging/production bundles with meteor build, then moving into ./bundle/programs/server and npm install there.
I do the same thing with 1.3 version but now I have error message on trying to run bundle main file with node:
WARNING: npm peer requirements not installed:
- react#0.14.x not installed.
- react-addons-pure-render-mixin#0.14.x not installed.
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
/var/www/builds/1459320997/bundle/programs/server/node_modules/fibers/future.js:267
throw(ex);
^
Error: Can't find npm module 'react'. Did you forget to call 'Npm.depends' in package.js within the 'modules-runtime' package?
I use react-meteor-data meteor package.
However, I already have "react": "^0.14.8", and "react-addons-linked-state-mixin": "^0.14.8", in my package.json and of course installed it with npm install ... --save and it is working fine on development environment when I use meteor command.
Any additional actions needed to run it? Did they change how meteor package should be build for production and didn't changed their docs? (because I don't see any changes in docs concerning meteor build so far.
Update: I tried to manually npm install these packages into ./bundle/program/server. Now they consequentially requires packages already listed in my package.json. I suppose Meteor just ignore this file on bundle. Will try to add a bug in their tracker.
I used Meteor 1.2 to build new 1.3 code so it is the issue. It happened because currently I build on the server that had another Meteor version.
I used answer from another Stackoverflow user (Ian) Updating all Meteor packages to latest versions
Easiest way is to delete the contents of .meteor/versions and then save

Installing natural package in a meteor application

For having natural language processing facility. Have added natural node package in my application using "npm install natural". But after installation while running the application using "sudo meteor", got some error about ""ReferenceError: require is not defined"". After googling found that need to do following steps:
1) Remove node_modules on the top of the root of the application (Done this part)
2) Added "natural": "0.1.27" in packages.json file also
3) Install npm using ""mrt add npm"". But getting following error after installing it in the application, while using ""sudo meteor"".
=> Meteor 0.8.1.3 is available. Update this project with 'meteor update'.
Initializing mongo database... this may take a moment.
npm ERR! missing: rimraf#2.x, required by meteor-npm#0.1.10
npm ERR! missing: mkdirp#0.3.x, required by meteor-npm#0.1.10
npm ERR! not ok code 0
=> Errors prevented startup:
While building package router:
error: no such package: 'ui'
While building package npm:
error: couldn't read npm version lock information
=> Your application has errors. Waiting for file change.
Any pointers what should be done. Not getting anything, this error taking my whole time. Thanks in advance
To use NPM packages within your meteor application you need to first install meteor-npm
mrt add npm
You then have to add a packages.json file at the root of your project like so;
{
"natural": "0.1.27"
}
When this file changes, meteor will automatically update its dependencies.
You can then use var natural = Meteor.require("natural")

Resources