I'm trying to test out a node/backbone tutorial at this git hub site $ git clone git://github.com/antoviaque/backbone-relational-tutorial.git. When I start the node server (by running command node app), I'm getting an error that a method create doesn't exist in a restify module. The error's triggered right after the server appears to start
restify listening at http://0.0.0.0:3001
I'm not at all experienced with node, and would appreciate any help you can offer.
node_modules/restify/lib/server.js:724
d = domain.create();
Object function Domain(options){
...lots of code ommitted....
has no method 'create'
at Server._run (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:724:20)
at onRoute (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:592:38)
at Router.find (/Users/mm/Sites/backboneforum/node_modules/restify/lib/router.js:372:17)
at _route (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:532:29)
at Server._handle (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:617:17)
at Server.onRequest (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:201:22)
at Server.emit (events.js:70:17)
at HTTPParser.onIncoming (http.js:1514:12)
at HTTPParser.onHeadersComplete (http.js:102:31)
at Socket.ondata (http.js:1410:22)
To put the comments into an answer:
It does not work, because the domain module was introduced as part of Node.js 0.8. As you are running 0.6, it can not be found. Hence you get an appropriate error message.
As you have said, your package.json says:
"node": ">= 0.6.0 < 0.7.0"
Try adjusting this setting to a value that also accepts Node.js 0.8 (or even 0.10), or - which may be the better solution - get rid of this line completely. If you do not use any things specific to Node.js 0.6, everything should still work.
Hope this helps.
Related
I'm new to next.js and react. I have created a simple application and would like to serve it using pm2 and Apache.
When I run npm run dev in the folder of the next project, the server starts and I can see my application on port 3000 of localhost.
However, when pm2 attempts to run the application (I have set it to run on server boot), I get the following error in the pm2 logs:
SyntaxError: Unexpected token '<'
at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:119:18)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:468:14)
at async link (node:internal/modules/esm/module_job:67:21)
node --version is v16.19.0
npm --version is 8.19.3
Can someone help me to fix this issue? I don't understand why it is happening at the moment.
Without providing more information and context, it will be difficult to diagnose exactly what is going wrong. If you want good answers, you need to list out a more comprehensive list of things you've tried and information about how you are setting up nextjs with pm2.
But right now, the character is your best clue. "<" hints at the problem likely being that html markup is being loaded somewhere it shouldn't be.
I fixed it. I had neglected to build the project with npm run build. Once I'd done that, pm2 worked as desired.
I am trying to use graphql-upload in a typescript express app (graphql api) built with webpack. When I run with ts-node my app works fine. But when I compile with webpack and then run I get a weird error when I try to upload a file.
My setup
Typescript app
Apollo server / Typegraphql
Build with webpack
My Code
(stripped down to the essentials)
https://github.com/ziggy6792/graphql-file-uploads
My Problem
When I run with ts-node yarn start:ts:node then run yarn test an image gets uploaded no problem
But then I build with webpack yarn start then run yarn test I get the following error
/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:56105
if (!isObject(operations) && !Array.isArray(operations))
^
TypeError: isObject is not a function
at Busboy.<anonymous> (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:56105:18)
at Busboy.emit (node:events:378:20)
at Busboy.module.exports../node_modules/busboy/lib/main.js.Busboy.emit (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:32204:33)
at PartStream.onEnd (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:32528:15)
at PartStream.emit (node:events:390:22)
at Dicer.onPart (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:32386:13)
at Dicer.emit (node:events:378:20)
at Dicer.module.exports../node_modules/dicer/lib/Dicer.js.Dicer.emit (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:45439:35)
at Dicer.module.exports../node_modules/dicer/lib/Dicer.js.Dicer._oninfo (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:45540:12)
at SBMH.<anonymous> (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:45486:10)
[nodemon] app crashed - waiting for file changes before starting...
My Attempts to solve
I am not sure if this actually a problem with graphql-upload or webpack or something else. I also noticed that my issue looks similar to this issue, but I didn't really understand if there were any fixes to that issue and if indeed it is the same issue I am facing.
I tried to upgrade webpack (branch upgraded-packages) but this made the problem worse as I get this issue when I start the server
TypeError: Cannot read property 'graphql' of undefined
at getPeerDependencyGraphQLRequirement (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:104216:44)
at Object.ensureInstalledCorrectGraphQLPackage (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:104221:32)
at Function.checkForErrors (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:103346:27)
at Function.generateFromMetadataSync (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:103325:14)
at Function.generateFromMetadata (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:103315:29)
at Object.buildSchema (/Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:103940:61)
at /Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:99831:41
at Generator.next (<anonymous>)
at /Users/sive/Documents/workspace/graphql-file-uploads/dist/index.js:99819:71
at new Promise (<anonymous>)
Any help would be greatly appreciated.
My best guess at the problem
From reading the linked issue it seems like isObject seems to ship ECMA Script modules with a newer version. Webpack might pick the ES modules version, but this version differs in the sense that the default export is now default and Apollo Server would have to import it as such or call isObject.default. In this changelog they say it might be breaking for users using bundlers.
Your two options now:
You could use yarn force the dependency to a previous version of isobject:
{
...
"resolutions": {
"graphql-file-uploads/isobject": "3.0.1"
}
}
Or you could simply not bundle your app and use TypeScript for building instead. You lose the benefits of bundling, but you are using an environment that is much more common for running node apps. Furthermore you will use TypeScript as a compiler just like ts-node unifying your development and production tooling.
You can compile using TypeScript like this:
yarn tsc 'src/**/*.ts'
In your TSConfig you should configure the output so that it also emits files to /dist.
Have a locally running node.js app using mongoose to do crud with mlab's mongodb. No problems
I post my code to github, and then tell Azure to host my app as a webapp, which I have done many times without mongoose.
As best I can tell, Azure does an npm install on my package.json file on my behalf as it installs my app into one of their web server hosts.
If I comment out these lines in my users.js route:
//var mongoose = require('mongoose');
//var ObjectID = require('mongodb').ObjectID;
all is well, Azure runs my app.
If I do not comment them out, I get this error written in the Azure log:
npm http GET https://registry.npmjs.org/mongoose
npm ERR! Error: SSL Error: CERT_UNTRUSTED
In an effort to fix this in my package.json file, I have:
[1] forced azure to use this version of node
"engines": {
"node": "0.8.x"
},
[2] tried to force to a current version
"mongoose": "^5.3.11",
[3] tried to force negotiator to this version as GitHub was complaining about a security issue with negotiator
"negotiator": ">=0.6.1",
I would REALLY like to continue to have Azure run my web apps using GitHub, and not get into the Azure command line stuff to install my bits, so I don't have much control of the installation. There is something about Mongoose that is bad.
thanks
One thing you could try is updating to the newer certificates' definitions.
This version of config-defs.js might do the trick (usually located under /deps/npm/lib/utils).
You might also need to update that file with an additional certificate as described here
Hope it helps!
Neil Lunn fixed it, thanks. I was having problems running v10.x.x of node, and tried dropping back to V8.x.x to get around a breaking change in v10, and I screwed up the name of V8. "node": "0.8.x" does not get V8, 8.10.0 does and all is well.
I need help.
After upgrading meteor to 0.7 version, application can not start with strange error (but, before update and if i create a new app - it worked well):
ant#ant-VirtualBox:~/testtracker$ mrt
Stand back while Meteorite does its thing
Done installing smart packages
Ok, everything's ready. Here comes Meteor!
[[[[[ ~/testtracker ]]]]]
/home/ant/.meteor/tools/ec9f953f89/lib/node_modules/fibers/future.js:173
throw(ex);
^
TypeError: Cannot call method 'split' of undefined
at parseStack (/home/ant/.meteor/tools/ec9f953f89/tools/buildmessage.js:257:26)
at Object.exception (/home/ant/.meteor/tools/ec9f953f89/tools/buildmessage.js:399:17)
at /home/ant/.meteor/tools/ec9f953f89/tools/packages.js:448:22
at Array.forEach (native)
at Function._.each._.forEach (/home/ant/.meteor/tools/ec9f953f89/lib/node_modules/underscore/underscore.js:79:11)
at _.extend.build (/home/ant/.meteor/tools/ec9f953f89/tools/packages.js:235:7)
at /home/ant/.meteor/tools/ec9f953f89/tools/packages.js:1041:13
at Array.forEach (native)
at Function._.each._.forEach (/home/ant/.meteor/tools/ec9f953f89/lib/node_modules/underscore/underscore.js:79:11)
at _.extend.build (/home/ant/.meteor/tools/ec9f953f89/tools/packages.js:1040:7)
at _.extend.getForApp (/home/ant/.meteor/tools/ec9f953f89/tools/library.js:285:9)
at /home/ant/.meteor/tools/ec9f953f89/tools/bundler.js:1646:25
at Object.capture (/home/ant/.meteor/tools/ec9f953f89/tools/buildmessage.js:175:5)
at Object.exports.bundle (/home/ant/.meteor/tools/ec9f953f89/tools/bundler.js:1580:31)
at /home/ant/.meteor/tools/ec9f953f89/tools/run.js:532:32
at /home/ant/.meteor/tools/ec9f953f89/tools/fiber-helpers.js:24:12
Please, give me advice, what i can do with this.
I think you need to update mrt packages as well.
mrt update
Do you use the mongodb instance from meteor or do you use an external mongodb instance (used by MONGO_URL env) ?
I got the same problem because it seems that mongolab doesn't accept the new oplog system from meteor.
Finally i now use the internal mongodb instance because i didn't find another solution from mongolab.
I downloaded node.js (.3), redis (2.0.4), and redis-node-client (git clone). When I start the redis server in one window, then go to the node-client folder and run
node test/test.js
I get
........................................
node.js:66
throw e; // process.nextTick error, or 'error' event on first tick
^
Maximum call stack size exceeded
I'm using the default configs at the moment. Haven't changed anything. Any ideas?
Hm, turns out to be version incompatibilities. Going to v0.2.5 fixes it.
Edit: nevermind, no it doesn't. Comes up with new error:
AssertionError: "testZINTER" "ERR unknown command 'zinter'"
at /Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/test/test.js:121:25
at Client.onReply_ (/Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:400:34)
at /Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:143:30
at ReplyParser.feed (/Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:160:55)
at Stream.<anonymous> (/Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:337:28)
at Stream.emit (events:27:15)
at IOWatcher.callback (net:489:16)
at node.js:773:9
Sadly, redis-node-client is no longer maintained. That's why I've written node_redis, which you can get with:
npm install redis
There are a lot of people using it now, and this has helped us work out a lot of bugs. Let me know if you have any issues with it.