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
Related
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
3|customapp | (node:1340043) UnhandledPromiseRejectionWarning: /app/node_modules/next/dist/server/next-server.js:91
3|customapp | compression = this.nextConfig.compress && this.nextConfig.target === "server" ? (0, _compression).default() : undefined;
3|customapp | ^
3|customapp | SyntaxError: Unexpected token =
3|customapp | at Module._compile (internal/modules/cjs/loader.js:723:23)
3|customapp | at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
3|customapp | at Module.load (internal/modules/cjs/loader.js:653:32)
3|customapp | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
3|customapp | at Function.Module._load (internal/modules/cjs/loader.js:585:3)
3|customapp | at Module.require (internal/modules/cjs/loader.js:692:17)
3|customapp | at require (internal/modules/cjs/helpers.js:25:18)
3|customapp | at Timeout.getServerImpl [as _onTimeout] (/app/node_modules/next/dist/server/next.js:59:71)
3|customapp | at ontimeout (timers.js:436:11)
3|customapp | at tryOnTimeout (timers.js:300:5)
3|customapp | (node:1340043) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
3|customapp | (node:1340043) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
3|customapp | error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
3|customapp | Error: Not supported
3|customapp | at Object.loadConfig [as default] (/app/node_modules/next/dist/server/config.js:68:78)
3|customapp | npm
3|customapp | ERR! code ELIFECYCLE
This is the error I'm getting when trying to deploy NextJS to EC2 instance through code pipeline. When i try to run the app using pm2 start inside EC2 instance, it allows me. But through code pipeline, it shows errors. The Deployment stage seems completed, but when i took the logs of the pm2 this happens.
I was following https://gist.github.com/ArcRanges/3d1d95421984c40fffaf3fabc9ea7396
I was trying to get the app work, by testing curl --location --request GET 'http://localhost:3000/api/say' .
but it returned Connection refused ERR.
Then i tried pm2 log and got the above error regarding next.config.js
This is my next.config.js file
/** #type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
};
module.exports = nextConfig;
buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
nodejs: 16.x
commands:
# install npm
- npm install -f
- npm install next -g
build:
commands:
# run build script
- npm run build
artifacts:
# include all files required to run application
# notably excluded is node_modules, as this will cause overwrite error on deploy
files:
- assets/**/*
- components/**/*
- containers/**/*
- pages/**/*
- public/**/*
- scripts/**/*
- settings/**/*
- styles/**/*
- tsconfig.json
- package.json
- appspec.yml
- postcss.config.js
- tailwind.config.js
- next.config.js
appspec.yml
version: 0.0
os: linux
files:
- source: /
destination: /app
overwrite: true
permissions:
- object: /
pattern: "**"
owner: root
group:
hooks:
BeforeInstall:
- location: scripts/before_install.sh
timeout: 300
runas: root
AfterInstall:
- location: scripts/after_install.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/application_start.sh
timeout: 300
runas: root
scripts/before_install.sh
#!/bin/bash
cd /app
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
apt -y install nodejs npm
scripts/after_install.sh
#!/bin/bash
cd /app
npm install -f
npm install pm2 -g
scripts/application_start.sh
#!/bin/bash
cd /app
npm run build
echo "After Build"
node -e "console.log('Running node.js '+process.version)"
pm2 start npm --name "customapp" -- start
pm2 startup
pm2 save
pm2 restart all
I'm creating an empty project with yarn 3.2.0:
$ corepack prepare --activate yarn#3.2.0
Preparing yarn#3.2.0 for immediate activation...
$ yarn init
{
name: 'yarn-parcel',
packageManager: 'yarn#3.2.0'
}
Then I add parcel package: (version 2.4.1 is installed)
$ yarn add -D parcel
...
And then I create an index.html and run parcel:
$ echo '<body>Hello</body>' > index.html
$ yarn parcel ./index.html
And it gives me this error:
Server running at http://localhost:1234
🚨 Build failed.
#parcel/transformer-js: Could not resolve module "#parcel/core" from
"/home/shayan/Coding/yarn-parcel/.yarn/__virtual__/#parcel-workers-virtual-7d738da563/0/cache/#parcel-workers-npm-2.4.1-6f10a6c026-bc55779f8d.zip/node_modules/#parcel/workers/lib/Handle.js"
Error: Could not resolve module "#parcel/core" from
"/home/shayan/Coding/yarn-parcel/.yarn/__virtual__/#parcel-workers-virtual-7d738da563/0/cache/#parcel-workers-npm-2.4.1-6f10a6c026-bc55779f8d.zip/node_modules/#parcel/workers/lib/Handle.js"
at $0578d0f6e116167e$export$fb2a0b866a8162dc.resolve
(/home/shayan/Coding/yarn-parcel/.yarn/__virtual__/#parcel-package-manager-virtual-9893719388/0/cache/#parcel-package-manager-npm-2.4.1-fee8a770b4-7ca98814d5.zip/node_modules/#parcel/package-manager/lib/index.js:4919:21)
at NodePackageManager.resolveSync
(/home/shayan/Coding/yarn-parcel/.yarn/__virtual__/#parcel-package-manager-virtual-9893719388/0/cache/#parcel-package-manager-npm-2.4.1-fee8a770b4-7ca98814d5.zip/node_modules/#parcel/package-manager/lib/index.js:3510:42)
at NodePackageManager.requireSync
(/home/shayan/Coding/yarn-parcel/.yarn/__virtual__/#parcel-package-manager-virtual-9893719388/0/cache/#parcel-package-manager-npm-2.4.1-fee8a770b4-7ca98814d5.zip/node_modules/#parcel/package-manager/lib/index.js:3351:34)
at Module.m.require
(/home/shayan/Coding/yarn-parcel/.yarn/__virtual__/#parcel-package-manager-virtual-9893719388/0/cache/#parcel-package-manager-npm-2.4.1-fee8a770b4-7ca98814d5.zip/node_modules/#parcel/package-manager/lib/index.js:3365:25)
at require (node:internal/modules/cjs/helpers:102:18)
at _core
(/home/shayan/Coding/yarn-parcel/.yarn/__virtual__/#parcel-workers-virtual-7d738da563/0/cache/#parcel-workers-npm-2.4.1-6f10a6c026-bc55779f8d.zip/node_modules/#parcel/workers/lib/Handle.js:9:16)
at Object.<anonymous>
(/home/shayan/Coding/yarn-parcel/.yarn/__virtual__/#parcel-workers-virtual-7d738da563/0/cache/#parcel-workers-npm-2.4.1-6f10a6c026-bc55779f8d.zip/node_modules/#parcel/workers/lib/Handle.js:57:5)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Object.require$$0.Module._extensions..js (/home/shayan/Coding/yarn-parcel/.pnp.cjs:11439:33)
(Adding --log-level verbose does not add any details.)
The problem is with nodeLinker: pnp. If I set nodeLinker: node-modules, then it works fine.
Unplugging parcel did not help.
What can I do?
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....
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.
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 ?