Vercel build failing with MERN stack - #zeit/ncc module fail - node.js

I'm trying to learn the MERN stack, so I followed the starter guide on MongoDB.com. That all worked fine locally, but when I tried hosting it on Vercel (to get an idea of the limitations and challenges), it spat out a pretty confusing error:
Error: Module build failed (from /vercel/c502a1cc836b238f/.build-utils/.builder/node_modules/#zeit/ncc/dist/ncc/loaders/relocate-loader.js)
Here's the structure of the project
client
node_modules
public
src
index.js
App.js
package.json
server
server.js
package.json
db
conn.js
package.json
vercel.json
node_modules
.gitignore
The react app was made with create-react-app, and then I just copy-pasted the instructions from MongoDB. The server was made manually.
I tried installing and uninstalling both #vercel/ncc and #zeit/ncc, but neither seemed to change anything.
Thanks for taking the time to read this.

Related

Nodemon crashed while setting up express server

while setting up an express server, I tried to run it, bt is showing an error, the exact phrase I typed on the terminal is (npm run dev), I checked whether my port is already under work or if there same name file in my laptop and whether my package.json is in the same folder of my server.js .. nothing is working, being a newbie it's my first project. I would be most grateful if the community can help me.
server.js window - showing error
package.json code
You're trying to require express and your package.json doesn't include it so I assume you don't have it installed
npm install express should fixt it

Webpack Node.js on Heroku Deployment Error

I built an application with React/Node.js/PostgreSQL Webpack and now attempting to deploy on heroku.
Everything works perfectly on my localhost, but it doesn't serve on Heroku. error message image on Heroku -
I've tried multiple buildpacks to make it happen, but it still gives me the same result, and I cannot figure out the problem as my logs don't seem to have any issues.
Any ideas would be greatly appreciated.
Here is the link to my repo https://github.com/strongharris/Edu-it
To Run it:
npm install ->
npm run build ->
npm start
The problem here is with your code. I tried to deploy a copy of your project to Heroku, and it's giving me an error because config.connection does not exist when you use it in a conditional.
Here's the error:
(These logs were retrieved by me deploying the Heroku app, then running heroku logs to view the log output.)
As you can see, the error is here: https://github.com/strongharris/Edu-it/blob/master/server/database/database_config.js#L9
You'll need to re-write this code so it runs properly without that variable.

Angular2 throws error while use the node modules reference

I am getting error while i use the angular2 from node_modules.
How do I fix? What I missed in my html file?
Please give me a git repo for angular2 for offline development.
Edit: I missed that the console was throwing other errors, too. I use Karma to run unit tests for an angular2 app and borrowed much of my test setup from the angular2 project itself.
Karma loads the files and since I'm using them for test, I load out of node_modules. The first four must be loaded first and in this order before bringing in angular2 and other libs:
'node_modules/angular2/node_modules/traceur/bin/traceur-runtime.js',
'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/angular2/**/*.js
Then a test helper configures System:
System.config({
...
paths: {
'angular2/*': 'node_modules/angular2/*.js',
'rx': 'node_modules/angular2/node_modules/rx/dist/rx.js'
}
...
});
Hope that helps. You may want to pull the files you need into a lib directory if you're serving them with your code.

Openshift nodejs app says can't find module that is in node_modules

I have a nodejs app on openshift but I am getting a startup error saying it can't find a module that actually is in the app-root/run-time/repo/node_modules folder. App works locally just fine. Appreciate any insight.

Cannot find module 'express' cloudfoundry node08 during deployment

While deploying the nodejs application in cloudfoundry.. it s giving error "Cannot find module 'express'".. Appreciate any help in this regard.. It is very simple hello world program.. Even the package.json is pretry simple.. Is there any cloudfoundry specific changes that needs to be done..
Thanks
Make sure to have modules already installed using "npm install". Or, do "npm shrinkwrap", Create package.json file w/ {"ignoreNodeModules": true} to ask CF to install modules in the cloud. See: http://www.youtube.com/watch?v=rCrXhNGDhhY&list=UU0ZYS0Y7b5oiVLvxGf4magw&index=4&feature=plcp

Resources