failed to load next.config.js when building using github action - node.js

I am using simple ssh deploy action and i have a bash script to build and restart pm2 frontend process.
It's working fine when I run it directly run the script through the ec2 instance but gives error when building through the github action
below is the generated error
It says Failed to load next.config.js but its there, I've printed out pwd to make sure its the correcy directory. But still the same error
Node -> 14.17.0
Next -> 12.0.8
npm -> 6.14.3
out: /home/***/elfswap/elfswap-frontend
out:
out: > fe-elf# build /home/***/elfswap/elfswap-frontend
out: > next build
out:
err: error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
err:
err: > Build error occurred
err: Error: Not supported
err: at Object.loadConfig [as default] (/home/***/elfswap/elfswap-frontend/node_modules/next/dist/server/config.js:413:78)
#!/bin/bash
cd /home/ubuntu/project/frontend
git pull origin master
echo "$(pwd)"
npm run build
pm2 restart frontend

Looking back at it with a fresh mind, figured out the problem.
I already knew that remote ssh doesn't load the bash profile, but node command was working fine so i didn't look much further.
but after echoing node version in the bash script, found out it was using version 8.. from /usr/local/bin not the one installed through nvm.
So to make it work, I removed npm, node binaries from /usr/local/bin and replaced those with symbolic links from nvm version directory.
Now its working fine.

Related

Issue with node while building svelte application in cloudflare pages

When I try and deploy my svelte project in Cloudflare pages I get this error
22:58:31.466 Cloning repository...
22:58:32.245 From https://github.com/ehubbartt/ethanhub
22:58:32.245 * branch 7807b7d14bc466249b9955d9ef06431003cd53ac -> FETCH_HEAD
22:58:32.246
22:58:32.295 HEAD is now at 7807b7d sdfs
22:58:32.295
22:58:32.438
22:58:32.464 Success: Finished cloning repository files
22:58:33.142 Installing dependencies
22:58:33.155 Python version set to 2.7
22:58:35.570 Attempting node version 'NODE_VERSION=12.18.0' from .nvmrc
22:58:37.196 Version 'NODE_VERSION=12.18.0' not found - try nvm ls-remote to browse available versions.
22:58:37.199 Failed to install node version 'NODE_VERSION=12.18.0'
22:58:37.204 Failed: build command exited with code: 1
22:58:38.110 Failed: an internal error occurred
Here is whay my .nvmrc file contains
NODE_VERSION=12.18.0
And I also have the environment variable set for the page.
NODE_VERSION=12.18.0
I have tried setting the version to many different things but can't quite get it to work and build

shadow-cljs watch app error on luminus page

I am using luminus to build a webpage. I want to use clojure script so I created a project with
lein new luminus test +cljs
When starting the webpage I get the following message:
If you're seeing this message, that means you haven't yet compiled your ClojureScript!
Please run shadow-cljs watch app to start the ClojureScript compiler and reload the page.
so I installed and tried to run
npx shadow-cljs watch app
and get the following error:
shadow-cljs - config: /Users/jonas/Dropbox/prog/web/clojure/luminus/test/shadow-cljs.edn
shadow-cljs - running: lein with-profile +dev run -m shadow.cljs.devtools.cli --npm watch app
Executable 'lein' not found on system path.
i've looked everywhere but I cannot solve this problem. Any ideas?
update:
ok, this is what I have done to temporarily solve this:
First install in the test dir:
npm install react react-dom create-react-class
then run lein directly:
lein with-profile +dev run -m shadow.cljs.devtools.cli --npm watch app
so it is not suppose to be like this, but this is the closest that I get.
ok, I looked after a path variable to set but could not find one. So I simply copied lein from ~/bin/lein (my home dir) to /usr/local/bin and now it found it and it works.
Strange that there is no way to set this for shadow

Phusion Passenger SyntaxError: Unexpected identifier at passenger _start_

I'm trying to install https://github.com/zadam/trilium.git on my A2 shared hosting server. The instructions for cPanel and SSH terminal both show a start command like:
passenger start --app-type node ./trilium/src/www app.js
But everything I try reports:
App 15779 output: passenger start --app-type node ./trilium/src/www app.js
App 15779 output: ^^^^^
App 15779 output: SyntaxError: Unexpected identifier
App 15779 output: at Module._compile (internal/modules/cjs/loader.js:723:23)
...
I'm new to Passenger, and don't have direct access to its setup. The techs at the hosting service seem equally lost. How can a statement that is recommended in all the help files fail at the first command?
Maybe it highlights start if any of the following parameters are wrong?
Maybe the command is being stored in the wrong location? But it finds that command when I try to Start Passenger...
That unhelpful error message, and a lot of similar ones, seems to have resulted from an initial failure to "npm install" my package.
When I tried a clean start of the whole process, using the terminal instead of cPanel, I had access to the logs from npm, and I found this:
...
> better-sqlite3#7.4.3 install /home/psychoro/trilium/node_modules/better-sqlite3
> prebuild-install || npm run build-release
prebuild-install WARN install /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/psychoro/trilium/node_modules/better-sqlite3/build/Release/better_sqlite3.node)
> better-sqlite3#7.4.3 build-release /home/psychoro/trilium/node_modules/better-sqlite3
> node-gyp rebuild --release
The session locked up there, and the system would not let me open another terminal to investigate. I resorted to ^C and my terminal access was restored. I suspect that corresponds to the event during my initial install when I was using cPanel and the access to all of it locked up with no explanation.
So all the useless error messages I saw later were produced by an installation that had crashed midway.
It does seem like "WARN" is a bit bland for a condition that kills the install and leaves chaos behind. And that "npm install" should be able to survive a missing file reference... But I suppose that isn't Phusion's responsibility...
Oh, and my command above was wrong:
passenger start --app-type node ./trilium/src/www app.js
should have been:
passenger start --app-type node --startup-file ./trilium/src/www
The guide I was following back then made it seem like "--startup-file" was a placeholder to be replaced by the name of my package's file. Still doesn't explain why it errored on "start" instead of my obvious error.
...

Getting error when deploying a Google Cloud Function after Node upgrade

I updated Brew then updated Node from 10.12.0 -> 13.8.0
Now, I get the following error when trying to deploy a Google Cloud Function
firebase deploy --only functions:createJWT
i functions: preparing functions directory for
uploading...
Error: Error parsing triggers: Failed to load gRPC binary module
because it was not installed for the current system Expected
directory: node-v79-darwin-x64-unknown Found:
[node-v64-darwin-x64-unknown] This problem can often be fixed by
running "npm rebuild" on the current system Original error: Cannot
find module
'/Users/.../cloud-functions/functions/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown/grpc_node.node'
Require stack:
- /Users/.../cloud-functions/functions/node_modules/grpc/src/grpc_extension.js
- /Users/.../cloud-functions/functions/node_modules/grpc/src/client_interceptors.js
- /Users/.../cloud-functions/functions/node_modules/grpc/src/client.js
- /Users/.../cloud-functions/functions/node_modules/grpc/index.js
- /Users/.../cloud-functions/functions/node_modules/#google-cloud/common-grpc/src/service.js
- /Users/.../cloud-functions/functions/node_modules/#google-cloud/common-grpc/src/operation.js
- /Users/.../cloud-functions/functions/node_modules/#google-cloud/common-grpc/src/index.js
- /Users/.../cloud-functions/functions/node_modules/#google-cloud/logging/src/index.js
- /Users/.../cloud-functions/functions/index.js
- /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js
Try running "npm install" in your functions directory before
deploying.
Tried npm rebuild and npm install in my functions directory and nothing works
Furthermore...could this issue be due to the fact that GCF Node runtime enviroment is Node10 and I have installed Node13 on my machine? - according to these docs:
https://cloud.google.com/functions/docs/concepts/nodejs-10-runtime
I am struggling to revert back to Node10, have tried by running brew install node#10 and get this:
Then tried running the following command as per output above to symlink it to /usr/local but still no luck
echo 'export PATH="/usr/local/opt/node#10/bin:$PATH"' >> ~/.bash_profile
Searching around about this error, indeed, this seems that the problem is related to your system waiting for a version and founding another one - as per this part of the error.
Error: Error parsing triggers: Failed to load gRPC binary module because it was not installed for the current system Expected directory: node-v79-darwin-x64-unknown Found: [node-v64-darwin-x64-unknown]
There are some options that you can give it a try, besides trying the npm rebuild. Another option might be updating the package.json - as per this case solved here - that would return your npm version to an old one.
Besides that, on this question in the Community, there are a few solutions that helped other users, that I would recommend you to take a look at it: NodeJs Error - Failed to load gRPC binary module because it was not installed for the current system Expected directory?
Let me know if the information helped you!
Trying to deploy to an unsupported Google Function execution environment won't work. According to the google docs the current supported environments are Node8 and Node10(beta), re-installing Node10 worked for me.

How to deploy apigee proxies with node target servers that use node modules that are not pre-installed?

This question is about deploying proxies with node target servers that use node modules that are not pre-installed. We use apigee edge running on-premises.
The node target servers runs fine locally.
The question is simple: How do I deploy such proxies with node target servers to apigee edge on-premises?
Attempt 1
I have tried packaging the proxy into a zip-file as usual and uploaded it in the web browser using the 'import into new revision' feature. It has worked fine for simpler proxies (that only use pre-installed node modules). All dependencies are listed in the packages.json file. When the proxy is deployed, every api call results in:
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 148
{"fault":{"faultstring":"Script node executed prematurely: Script exited with code 0","detail":{"errorcode":"messaging.runtime.ScriptExitedError"}}}
Attempt 2
I've also tried to install the modules locally using 'npm install' and then include the modules in the zip. However, in this case there is a red error message the import failed. When I reload the api proxy page in the web browser it seems like the package was actually uploaded, and the box that show loading progress goes to more than 2000%. However, when the loading has completed, it is not possible to deploy it (a standard unspecific error message is displayed).
Attempt 3
Finally I have also tried the apigeetool using the syntax at http://apigee.com/docs/api-services/content/adding-nodejs-existing-api-proxy (I did change the url in the python source code to our on-premises server). Before running the tool, the modules are installed using 'npm install'. The result is this error message:
Importing new application %PROXYNAME%
/v1/organizations/%ORGANIZATION%/apis?action=import&name=%PROXYNAME%
Import failed to
/v1/organizations/%ORGANIZATION%/apis?action=import&name=%PROXYNAME%
with status 404: {"fault":{"faultstring":"Classification failed for
host %IP%:%PORT%","detail":{"code":"CLASSIFICATION_FAILED"}}}
Assuming you're using OSX or a flavour of *nix:
Create a folder on your local machine to contain your Node script (e.g. /Development/myNodeProxy/). Place your script there. (e.g. server.js).
Open Terminal and cd to your script folder (/Development/myNodeProxy/).
Use npm to install the modules you need (type npm install {modulename} without the global -g switch). Caveat: Edge doesn't play nice with conflicting versions of Express, so you will need to npm remove express before deploying. You may need to remove other the modules that are preinstalled on Edge too if you end up getting errors (like errno 32 broken pipe).
From the same directory, run the following command:
apigeetool deploynodeapp -n {name-of-your-proxy} -o {org} -e {environment} -b {proxy-basepath} -d ./ -m server.js -u {your-email-address/username} -p {password}

Resources