MEAN starter kit showing error on installation - node.js

I wanted a mean starter kit so that I can build my app. Then I got this from github. I just made it setup then made npm install and then made npm start. But it showed me several errors like this
[nodemon] 1.12.1
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching: *.*
[0] [nodemon] starting `node server.js`
[0] ✓ App is running at http://localhost:3000 in development mode
[0] Press CTRL-C to stop
[0]
[1] Cannot read property 'config' of null
[1] TypeError: Cannot read property 'config' of null
[1] at Class.run (/Users/Sites/tryouts/mean/node_modules/#angular/cli/tasks/serve.js:51:63)
[1] at check_port_1.checkPort.then.port (/Users/Sites/tryouts/mean/node_modules/#angular/cli/commands/serve.js:123:26)
[1] at <anonymous>
[1] at process._tickCallback (internal/process/next_tick.js:188:7)
So can someone tell me how to make this working? Any help and suggestions will be really appreciable.

Related

React App failed to compile after install

After running the install script, the server starts and serves a page displaying the same text after the 'Failed to compile line.'
I'm running Windows 10 and auto update just updated my pc today, right before I did the create-react-express install.
PS H:\mern-passport> npm start
> mern#1.0.0 start H:\mern-passport
> if-env NODE_ENV=production && npm run start:prod || npm run start:dev
> mern#1.0.0 start:dev H:\mern-passport
> concurrently "nodemon --ignore 'client/*'" "npm run client"
[0] [nodemon] 1.19.4
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching dir(s): *.*
[0] [nodemon] watching extensions: js,mjs,json
[0] [nodemon] starting `node server.js`
[0] API server now on port 3001!
[1]
[1] > mern#1.0.0 client H:\mern-passport
[1] > cd client && npm run start
[1]
[1]
[1] > mern#0.1.0 start H:\mern-passport\client
[1] > react-scripts start
[1]
[1] Starting the development server...
[1]
[1] Failed to compile.
[1]
[1] ./src/index.css (./node_modules/css-loader??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
[1] Error: Package exports for 'H:\mern-passport\client\node_modules\autoprefixer\node_modules\kleur' do not define a valid './colors' target
[0] Error: ENOENT: no such file or directory, stat 'H:\mern-passport\client\build\index.html'
[0] Error: ENOENT: no such file or directory, stat 'H:\mern-passport\client\build\index.html'
Seems to be an issue with autoprefixer latest version. I referred https://github.com/postcss/autoprefixer/issues/1328 and tried downgrading autoprefixer in my project and it works now.
Try:
npm install autoprefixer#9.8.0
Happy coding!
I also faced this problem. And it looks like a problem with autoprefixer version, so i changed the version.
npm install autoprefixer#9.8.0
I tried this, and it works perfectly.
I was running into this issue too. I installed yarn and created a new project with the npx create-react-app command and this fixed the issue.

node.js & react - server not up, from github project

I found one project on GitHub darkwire and wanted to install it and play with it. Firstly I tried to install it from windows. I installed Node.js and Yarn and I got errors with the command: yarn dev
`C:\darkwire.io-master>yarn dev
yarn run v1.21.1
$ concurrently 'cd client && yarn start' 'cd server && yarn dev'
[0] 'c' is not recognized as an internal or external command,
[0] operable program or batch file.
[1] 'client' is not recognized as an internal or external command,
[1] operable program or batch file.
[0] c exited with code 1
[1] client exited with code 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`
My next step was to try it in ubuntu 19.10, firstly I installed again Node.js and Yarn and again used: yarn dev. I got an error but now was open site and it not working, just say "Disconnected"
```qq#ubuntu:~/Downloads/darkwire.io-master$ yarn dev
yarn run v1.21.1
$ concurrently 'cd client && yarn start' 'cd server && yarn dev'
$ nodemon src/index.js --exec babel-node
$ react-scripts start
[1] [nodemon] 1.19.0
[1] [nodemon] to restart at any time, enter `rs`
[1] [nodemon] watching: *.*
[1] [nodemon] starting `babel-node src/index.js`
[1] Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
[1] Checking for inactive rooms...
[1] Darkwire is online at port 3001
[1] events.js:183
[1] throw er; // Unhandled 'error' event
[1] ^
[1]
[1] Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
[1] at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
[1] [nodemon] app crashed - waiting for file changes before starting...
[0] Starting the development server...
[0]
[0] Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
[0] Compiled successfully!
[0]
[0] You can now view darkwire-client in the browser.
[0]
[0] Local: http://localhost:3000/
[0] On Your Network: http://175.124.13.111:3000/
[0]
[0] Note that the development build is not optimized.
[0] To create a production build, use yarn build.
[0]
```
screenshot
I think maybe I have the wrong version Node.js and try install 9.x version, download again project and try again, it not help, try change port from 3001 to 3000, not help.
From their README.md
Darkwire Server
Darkwire server is a Node.js application that requires redis.
So please install a compatible redis server. Redis tutorial

nodemon throwing unhandled error event

I am trying to run nodemon on my local pc.
Even if i just run the command without parameters i get the following error:
events.js:182
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at _errnoException (util.js:1019:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
at onErrorNT (internal/child_process.js:374:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Turning on Verbose mode gives additional info along wiht this error:
[nodemon] Looking in package.json for nodemonConfig
[nodemon] 1.12.1
[nodemon] reading config C:\nodeprojects\myproject\package.json
[nodemon] to restart at any time, enter `rs`
[nodemon] ignoring: .git .nyc_output .sass-cache bower_components coverage C:\nodeprojects\myproject\node_modules/**/*
[nodemon] watching: *.*
[nodemon] watching extensions: js,json
[nodemon] starting `node app.js`
[nodemon] child pid: undefined
[nodemon] exiting
events.js:182
throw er; // Unhandled 'error' event
^
(Note - paths in above error altered to remove my username)
I have tried the basics, restarting my pc, checking if another app is using port 3000 (i dont think it is).
Any help or advice would be appreciated
Nodemon simply starts command "node app.js", if start node ok, it'll track files changes and restart node process.
Your error seems to cause by lack of nodejs configurations.
Try to check node program directory path is included in PATH variable or not.
In the windows pc, there're steps:
Find node install folder, commonly in C:\Program Files\nodejs or C:\Windows\System32\
Check this folder path in PATH variable value.

Cannot start npm

I installed the seed app here: https://github.com/moizKachwala/Angular2-expressjs-mongoose-gulp-node-typescript
I'm trying to run npm start but the server is not being created and started.
I thought maybe this line "(node:16596) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version" was the issue and I found that on SO its was suggested to make sure you have latest npm which I do.
NOTE: The gulp script is supposed to create the dist folder where it will place all the js files but the dist folder is not being created so the gulp script is failing somewhere...
What else could it be?
c:\work\angular\pricecompare1>npm start
> angular2-express#1.0.0 start c:\work\angular\pricecompare1
> concurrent --kill-others "gulp watch" "gulp start"
[1] [09:35:54]
[0] [09:35:54] Requiring external module ts-node/register
[1] Requiring external module ts-node/register
[0] (node:16596) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[1] (node:17124) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[0] [09:35:55]
[0] Using gulpfile c:\work\angular\pricecompare1\gulpfile.ts
[1] [09:35:55] Using gulpfile c:\work\angular\pricecompare1\gulpfile.ts
[0] [09:35:55]
[0] Starting 'watch'...
[1] [09:35:55]
[1] Starting 'start'...
[1] [09:35:55]
[1] Finished 'start' after 1.88 ms
[1] [09:35:55] [nodemon] 1.10.0
[1] [09:35:55] [nodemon] to restart at any time, enter `rs`
[1] [09:35:55] [nodemon] watching: *.*
[1] [09:35:55] [nodemon] starting `node dist/server/server.js`
[0] [09:35:55] Finished 'watch' after 32 ms
[1] module.js:442
[1] throw err;
[1] ^
[1]
[1] Error: Cannot find module 'c:\work\angular\pricecompare1\dist\server\server.js'
[1] at Function.Module._resolveFilename (module.js:440:15)
[1] at Function.Module._load (module.js:388:25)
[1] at Module.runMain (module.js:575:10)
[1] at run (bootstrap_node.js:352:7)
[1] at startup (bootstrap_node.js:144:9)
[1] at bootstrap_node.js:467:3
[1] [09:35:55] [nodemon] app crashed - waiting for file changes before starting...
in your package.json file find start command and reference your server.js with correct directory
pricecompare1\dist\server\server.js

Error: failed to connect to [localhost:27017] when running MEAN app on HEROKU

I'm writing my second MEAN app. The first one was build aggregating the components by hand (I was not aware of MEAN) and hosting it at HEROKU; I attempted to use MONGOOSE but gave up due to problems connecting with the database at HEROKU - it worked fine on my MAC. This time around it works on my MAC but I'm still having connection problems; I do not want to jettison MONGOOSE. At this point all I have is the vanilla MEAN app built off its zip file, the zip file downloaded from the MEAN GitHUB repository. See below for the logs I get from HEROKU:
2013-09-10T01:33:28.045816+00:00 heroku[web.1]: Starting process with command `grunt`
2013-09-10T01:33:29.526090+00:00 app[web.1]: Running "jshint:all" (jshint) task
2013-09-10T01:33:29.567534+00:00 app[web.1]: >> 1 file lint free.
2013-09-10T01:33:29.568809+00:00 app[web.1]:
2013-09-10T01:33:29.568809+00:00 app[web.1]: Running "compass:dist" (compass) task
2013-09-10T01:33:29.573055+00:00 app[web.1]: Warning: You need to have Ruby and Compass installed and in your system PATH for this task to work. More info: https://github.com/gruntjs/grunt-contrib-compass Used --force, continuing.
2013-09-10T01:33:29.574527+00:00 app[web.1]: Warning: Cannot read property 'stdout' of undefined Used --force, continuing.
2013-09-10T01:33:29.574641+00:00 app[web.1]:
2013-09-10T01:33:29.575774+00:00 app[web.1]: Warning: You need to have Ruby and Compass installed and in your system PATH for this task to work. More info: https://github.com/gruntjs/grunt-contrib-compass Used --force, continuing.
2013-09-10T01:33:29.574641+00:00 app[web.1]: Running "compass:dev" (compass) task
2013-09-10T01:33:29.576128+00:00 app[web.1]: Running "concurrent:target" (concurrent) task
2013-09-10T01:33:29.576043+00:00 app[web.1]:
2013-09-10T01:33:30.414023+00:00 app[web.1]: Running "nodemon:dev" (nodemon) task
2013-09-10T01:33:30.511082+00:00 app[web.1]: 10 Sep 01:33:30 - [nodemon] v0.7.10
2013-09-10T01:33:30.511537+00:00 app[web.1]: 10 Sep 01:33:30 - [nodemon] to restart at any time, enter `rs`
2013-09-10T01:33:30.511664+00:00 app[web.1]: 10 Sep 01:33:30 - [nodemon] watching: /app/config
2013-09-10T01:33:30.511664+00:00 app[web.1]: 10 Sep 01:33:30 - [nodemon] watching: /app/app
2013-09-10T01:33:30.536018+00:00 app[web.1]: 10 Sep 01:33:30 - [nodemon] Unable to write to temp directory. If you experience problems with file reloading, ensure /tmp is writable.
2013-09-10T01:33:30.550590+00:00 app[web.1]: debugger listening on port 5858
2013-09-10T01:33:30.578354+00:00 app[web.1]: Running "watch" task
2013-09-10T01:33:30.624330+00:00 app[web.1]: Waiting...10 Sep 01:33:30 - [nodemon] reading ignore list
2013-09-10T01:33:31.152639+00:00 app[web.1]: throw er; // Unhandled 'error' event
2013-09-10T01:33:31.154862+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74)
2013-09-10T01:33:31.148967+00:00 app[web.1]: Express app started on port 3000
2013-09-10T01:33:31.152143+00:00 app[web.1]:
2013-09-10T01:33:31.152401+00:00 app[web.1]: events.js:72
2013-09-10T01:33:31.154862+00:00 app[web.1]: Error: failed to connect to [localhost:27017]
2013-09-10T01:33:31.154862+00:00 app[web.1]: at null.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
2013-09-10T01:33:31.154862+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:478:10)
2013-09-10T01:33:31.154862+00:00 app[web.1]: at Socket.EventEmitter.emit (events.js:95:17)
2013-09-10T01:33:31.154862+00:00 app[web.1]: at process._tickCallback (node.js:415:13)
Any comments of suggestions would be much welcome. Thanks in advance.
You need to host MongoDB somewhere. There are a number of MongoDB hosting services, MongoHQ and MongoLab the most popular. I have used MongoHQ with good results although I must admit I haven't stressed my system. You can sign up for the free trial (I think you get 512MB), once you have done that, replace your connection string with (you will get all the details when signing up):
'mongodb://username:password#domain:port/dbName'

Resources