cannot launch application server using "node server" in Angular 2 - macos

I am unable to launch my Angular 2 app using the node server command in my mac OSX. I am getting the following error :
Bharaths-MacBook-Air:<my-app> xyz$ node server
module.js:327
throw err;
^
Error: Cannot find module '/Users/xyz/Desktop/<my-app-dir>/Web/<my- app>/server'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3

Is the server.js file really in the directory <my-app>?
Try using node server.js or node ./server.js.

Related

Truffle Drizzle Tutorial fails on last step 'npm run dev'

I am on windows 10, using vscode. Basically finished the petshop tutorial with no issues or problems using truffle.
when I enter the command npm run dev it fails as shown below.
PS Y:\code\petshop> npm run dev
> pet-shop#1.0.0 dev
> lite-server
internal/modules/cjs/loader.js:316
throw err;
^
Error: Cannot find module 'Y:\code\petshop\node_modules\immutable\dist\immutable'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:308:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:521:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:872:27)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (Y:\code\petshop\node_modules\browser-sync\dist\hooks.js:3:17)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32) {
code: 'MODULE_NOT_FOUND',
path: 'Y:\\code\\petshop\\node_modules\\immutable\\package.json',
requestPath: 'immutable'
}
Not sure where to go from here, nothing works. This type of error is a bit beyond me. Any and all help is greatly appreciated.
EDIT: changed screenshot to code snippet. And I realized the problem is that the 'immutable' path is non-existent in my node_modules. Still not sure how to address this. tried a cheeky npm install immutable to no avail....

Unable to run postgresql for Phoenix

18:37:55.291 [error] GenServer #PID<0.191.0> terminating
** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
(db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Hello.Repo couldn't be created: an exception was raised:
** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
(db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
but I ran ~/brew services start postgresql
==> Successfully startedpostgresql(label: homebrew.mxcl.postgresql) first ..
So I try
~/locate psql
WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.
~/ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
/System/Library/LaunchDaemons/com.apple.locate.plist: service already loaded
How do I get my database up and running for Phoenix?
```
Error on npm install:
```
~/hello/npm install
module.js:538
throw err;
^
Error: Cannot find module 'semver'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
~/hello/
```
After creating a new Phoenix:
mix phx.new foo
It tells you what to do:
We are almost there! The following steps are missing:
$ cd foo
$ mix deps.get
$ cd assets && npm install && node node_modules/brunch/bin/brunch build
Then configure your database in config/dev.exs and run:
$ mix ecto.create # <----- you need this one
Start your Phoenix app with:
$ mix phx.server
You can also run your app inside IEx (Interactive Elixir) as:
$ iex -S mix phx.server

Cannot create Ignite-project

I am trying to create an Ignite project, but I only get a failure. Do you know why I get a failure? I have installed programs for creating a React-Active-project and these are working fine, I can create a normal React-Active-project. It would be nice to get a solution for this.
I am using Windows 10
C:\Users\user\AppData\Roaming\npm>ignite new project
� Setting project on FIRE! �
module.js:327
throw err;
^
Error: Cannot find module 'C:\Users\user\AppData\Roaming\npm\node_modules\yo\lib\cli.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3

HowTo launch node --debug grunt server on Windows?

Running Windows 8.1 and my environment is working great except I cannot start node in --debug so that node-inspector has something to connect to.
I have a Gruntfile setup with grunt-concurrent that lets me open, grunt-devtools, node-inspector then watch just fine but I can't figure out a workable syntax for getting that running with node in debug. Following is what I'd expect to work but also the error I get when I try. Notice that there is a message indicating that the debug server is listening, but something falls apart from there and fails so it does me no good.
C:\PROJECTS\bManWebService_Hapi>node --debug C:\Users\rainabba\AppData\Roaming\npm\grunt server
debugger listening on port 5858
C:\Users\rainabba\AppData\Roaming\npm\grunt:2
basedir=`dirname "$0"`
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:437:25)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
It looks like the file C:\Users\rainabba\AppData\Roaming\npm\grunt is not a JS file but a bash shell script. Look for grunt.cmd in the same folder if you need Windows-compatible version.
And event if you find grunt.cmd - starting it as node grunt.cmd is not a proper way. Most likely the grunt.cmd will start the node so you need to somehow pass the --debug argument to the node, called by the grunt.cmd or just run node exactly as grunt.cmd runs it.
tl; tr;
node --debug-brk c:\Users\rainabba\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt taskname
You have to use this executable
c:\Users\rainabba\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt
instead of this
c:\Users\rainabba\AppData\Roaming\npm\grunt server

Node.js - Error trying to run server.js

Trying to get AjaxIM working on my site with Node.js. I get an error however when I try to initiate server.js
Does anyone know what I am doing wrong and how to fix it??
The following output is produced when running this file:
-bash-3.2# /usr/src/node-v0.4.6/node /home/colleg60/public_html/development/ajaxim/server/server.js
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'tcp'
at Function._resolveFilename (module.js:320:11)
at Function._load (module.js:266:25)
at require (module.js:348:19)
at Object.<anonymous> (/home/colleg60/public_html/development/ajaxim/server/server.js:32:11)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
at Array.<anonymous> (module.js:423:10)
at EventEmitter._tickCallback (node.js:126:26)
Try changing 'tcp' to 'net'
might work.
also in any case you were using the old version of AjaxIM > http://groups.google.com/group/ajaxim/browse_thread/thread/151beb1881f36209 ?

Resources