Error while deploying React App on Vercel - node.js

I tried deploying my React App on Vercel but i get those error messages:
The cli flag --force was set. Skipping build cache download.
Cloning completed: 687.734ms
Running "vercel build"
Vercel CLI 28.4.17
Installing dependencies...
yarn install v1.22.17
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://git#github.com/ethereumjs/ethereumjs-abi.git
Directory: /vercel/path0
Output:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
yarn run v1.22.17
$ next build
info - Loaded env from /vercel/path0/.env
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
info - Linting and checking validity of types...
error - ESLint must be installed in order to run during builds: yarn add --dev eslint
info - Creating an optimized production build...
info - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
info - Using external babel configuration from /vercel/path0/.babelrc
Failed to compile.
../../usr/local/share/.config/yarn/global/node_modules/next/dist/pages/_document.js
Error: Cannot find module '#babel/preset-react'
Require stack:
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/core.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/version.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/verifyAndLint.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/build/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/cli/next-build.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/commands.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/bin/next
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.mod._resolveFilename (/usr/local/share/.config/yarn/global/node_modules/next/dist/build/webpack/require-hook.js:23:32)
at resolve (node:internal/modules/cjs/helpers:109:19)
at tryRequireResolve (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:41863)
at resolveStandardizedNameForRequire (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:42364)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:43011)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:716601)
at /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:717013
at Generator.next (<anonymous>)
at resolvePreset (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:40447)
../../usr/local/share/.config/yarn/global/node_modules/next/dist/pages/_error.js
Error: Cannot find module '#babel/preset-react'
Require stack:
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/core.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/version.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/verifyAndLint.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/build/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/cli/next-build.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/commands.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/bin/next
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.mod._resolveFilename (/usr/local/share/.config/yarn/global/node_modules/next/dist/build/webpack/require-hook.js:23:32)
at resolve (node:internal/modules/cjs/helpers:109:19)
at tryRequireResolve (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:41863)
at resolveStandardizedNameForRequire (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:42364)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:43011)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:716601)
at /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:717013
at Generator.next (<anonymous>)
at resolvePreset (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:40447)
./pages/_app.js
Error: Cannot find module '#babel/preset-react'
Require stack:
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/core.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/version.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/verifyAndLint.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/build/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/cli/next-build.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/commands.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/bin/next
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.mod._resolveFilename (/usr/local/share/.config/yarn/global/node_modules/next/dist/build/webpack/require-hook.js:23:32)
at resolve (node:internal/modules/cjs/helpers:109:19)
at tryRequireResolve (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:41863)
at resolveStandardizedNameForRequire (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:42364)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:43011)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:716601)
at /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:717013
at Generator.next (<anonymous>)
at resolvePreset (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:40447)
./pages/index.js
Error: Cannot find module '#babel/preset-react'
Require stack:
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/core.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/version.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/verifyAndLint.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/build/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/cli/next-build.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/commands.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/bin/next
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at resolve (node:internal/modules/cjs/helpers:109:19)
at tryRequireResolve (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:41863)
at resolveStandardizedNameForRequire (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:42364)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:43011)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:716601)
at /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:717013
at Generator.next (<anonymous>)
at resolvePreset (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:40447)
./pages/product/[slug].js
Error: Cannot find module '#babel/preset-react'
Require stack:
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/core.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/version.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/telemetry/events/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/verifyAndLint.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/build/index.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/cli/next-build.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/lib/commands.js
- /usr/local/share/.config/yarn/global/node_modules/next/dist/bin/next
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.mod._resolveFilename (/usr/local/share/.config/yarn/global/node_modules/next/dist/build/webpack/require-hook.js:23:32)
at resolve (node:internal/modules/cjs/helpers:109:19)
at tryRequireResolve (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:41863)
at resolveStandardizedNameForRequire (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:42364)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:43011)
at sync (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:716601)
at /usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1910:717013
at Generator.next (<anonymous>)
at resolvePreset (/usr/local/share/.config/yarn/global/node_modules/next/dist/compiled/babel/bundle.js:1:40447)
> Build failed because of webpack errors
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
I can't deploy on Vercel, any tip on how to fix that?
Thanks in advance.
I'll also leave a link to a video including the full Vercel log with errors highlighted in red: https://www.veed.io/view/218cb302-0a04-406f-84a9-7b5d353a2ffa?sharingWidget=true&panel=share
I tried building and launching the React App on Visual Studio with "yarn run dev" and "yarn run build" and everything works fine, proglems appear while trying to deploy it on Vercel.

Related

<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies

Trying to run a project on my VPS but im constantly getting this error flagged up. i have tried clearing and installing everything fresh but the problem still occurs. any help would be greatly appreciated.
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 64.298367 ms
info - Creating an optimized production build ... [webpack.cache.PackFileCacheStrategy] Pack got invalid because of write to: Compilation/modules|/home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-swc-loader.js??ruleSet[1].rules[2].oneOf[2].use!/home/admin/web/server/public_html/node_modules/next/dist/pages/_error.js
[webpack.cache.PackFileCacheStrategy] Storing pack...
[webpack.cache.PackFileCacheStrategy] Capturing build dependencies... (/home/admin/web/server/public_html/next.config.js, /home/admin/web/server/public_html/node_modules/next/dist/compiled/, /home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-swc-loader.js)
info - Creating an optimized production build .<t> [webpack.cache.PackFileCacheStrategy] resolve build dependencies: 90.189044 ms
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of /home/admin: Error: EACCES: permission denied, open '/home/admin'
<t> [webpack.cache.PackFileCacheStrategy] snapshot build dependencies: 1.801434 ms
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies
[webpack.cache.PackFileCacheStrategy] Error: Unable to snapshot resolve dependencies
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:70754:13
at jobError (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47008:5)
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47071:10
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47968:13
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131419:5
at Hook.eval [as callAsync] (eval at create (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:23493:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:23295:14)
at AsyncQueue._handleResult (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131389:21)
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131372:11
at ReadFileContext.<anonymous> (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47917:12)
[webpack.cache.PackFileCacheStrategy] No pack exists at /home/admin/web/server/public_html/.next/cache/webpack/edge-server-production.pack: Error: ENOENT: no such file or directory, stat '/home/admin/web/server/public_html/.next/cache/webpack/edge-server-production/index.pack'
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 19.478739 ms
[webpack.cache.PackFileCacheStrategy] No pack exists at /home/admin/web/server/public_html/.next/cache/webpack/client-production.pack: Error: ENOENT: no such file or directory, stat '/home/admin/web/server/public_html/.next/cache/webpack/client-production/index.pack'
<t> [webpack.cache.PackFileCacheStrategy] restore cache container: 9.156366 ms
info - Creating an optimized production build ... [webpack.cache.PackFileCacheStrategy] Pack got invalid because of write to: Compilation/modules|/home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=next%2Fdist%2Fpages%2F_app&page=%2F_app!
[webpack.cache.PackFileCacheStrategy] Storing pack...
[webpack.cache.PackFileCacheStrategy] Capturing build dependencies... (/home/admin/web/server/public_html/next.config.js, /home/admin/web/server/public_html/node_modules/next/dist/compiled/, /home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js, /home/admin/web/server/public_html/node_modules/next/dist/build/webpack/loaders/next-swc-loader.js)
info - Creating an optimized production build .<t> [webpack.cache.PackFileCacheStrategy] resolve build dependencies: 102.05922 ms
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Error snapshotting file timestamp hash combination of /home/admin: Error: EACCES: permission denied, open '/home/admin'
<t> [webpack.cache.PackFileCacheStrategy] snapshot build dependencies: 2.324734 ms
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies
[webpack.cache.PackFileCacheStrategy] Error: Unable to snapshot resolve dependencies
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:70754:13
at jobError (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47008:5)
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47071:10
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47968:13
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131419:5
at Hook.eval [as callAsync] (eval at create (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:23493:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:23295:14)
at AsyncQueue._handleResult (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131389:21)
at /home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:131372:11
at ReadFileContext.<anonymous> (/home/admin/web/server/public_html/node_modules/next/dist/compiled/webpack/bundle5.js:47917:12)```
As stated in this discussion, the suitable soulution in your case seems to be
cd [your project]
npm install -g n
sudo n stable
rm -rf node_modules/
rm -f package-lock.json
npm install
I really can't reproduce the error so I'm not 100% confident this is going to work but you can give it a try and let us know.°
I also think you can skip the installation of a stable node version so, if you already have one, just try the clean npm install.
For me I just move my project to C:/ and return to work. But if you need to maintain the project in another disk, you can do this:
Go to your_project/node_modules/next/package.json
Change local in _where (Local in package)
Now you can start.
PS.: I don't know whats happening and a different form to change this package easily.
PS 2.: I google a lot, but didn't find anithing.

'npm install' gets stuck and eventually 'Killed' at something called 'swc...' on Ubuntu 20.04

Okay so I have been trying to deploy a Next app to my Ubuntu 20.04 vps but I am unable to do so. I have uploaded all the files from my local machine to the server via ftp and then after trying to install it gets stuck and then killed ( please check the image to see where it gets stuck ). The app works perfectly in my local machine.
I tried by deleting .next directory, node_modules directory as well as package-lock.json file but the problem prevails.
Here's the Node and NPM version in my local machine:
Node: v14.15.0
NPM: v7.14.0
This is the Node and NPM version in my server:
Node: v14.18.2
NPM: v8.3.0
I have also attached my package.json file incase you want to see the dependencies
UPDATE
I some how installed the dependencies but now I am getting different type of errors when I run 'npm run dev' or 'npm run build'.
Here's what I get after I run npm run dev:
[20:09] [server1.example.com boomboom] # npm run dev
> boomboom#0.1.0 dev
> next dev
warn - Port 3000 is in use, trying 3001 instead.
ready - started server on 0.0.0.0:3001, url: http://localhost:3001
info - Loaded env from /home/user1/node-apps/boomboom/.env.local
error - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[2]!./styles/Footer.module.css
/home/user1/node-apps/boomboom/node_modules/source-map/lib/util.js:101
// above the root is a no-op. Therefore we can remove all '.
SyntaxError: Unexpected end of input
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: SyntaxError: /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url/node_modules/whatwg-url/package.json (directory description file): SyntaxError: Unexpected end of JSON input
<w> while resolving 'whatwg-url' in /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url to a directory
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: SyntaxError: /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url/node_modules/whatwg-url/package.json (directory description file): SyntaxError: Unexpected end of JSON input
<w> while resolving 'whatwg-url' in /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url to a directory
This is what I get after I run npm run build:
[20:13] [server1.example.com boomboom] # npm run build
> boomboom#0.1.0 build
> next build
info - Loaded env from /home/user1/node-apps/boomboom/.env.local
info - Checking validity of types
error - ESLint: Failed to load plugin 'react' declared in '.eslintrc.json » eslint-config-next/core-web-vitals » /home/user1/node-apps/boomboom/node_modules/eslint-config-next/index.js': Cannot find module 'eslint-plugin-react' Require stack: - /home/user1/node-apps/boomboom/node_modules/eslint-config-next/index.js Referenced from: /home/user1/node-apps/boomboom/node_modules/eslint-config-next/index.js
> Build error occurred
/home/user1/node-apps/boomboom/node_modules/source-map/lib/util.js:101
// above the root is a no-op. Therefore we can remove all '.
SyntaxError: Unexpected end of input
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/home/user1/node-apps/boomboom/node_modules/source-map/lib/source-map-generator.js:9:12)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
info - Creating an optimized production build .[20:13] [server1.example.com boomboom] #

AWS SAM Lambda Application Development + AWS SDK -- Can't get a working example

I’m fairly new to AWS Lambda and I’m trying to set-up my environment to be able to develop a Lambda function, using vscode and to be able to use a debugger. The way to do this appears to be to develop a SAM (serverless application model) application, containing the lambda function. So I’ve set everything up as per the “hello world” example in the AWS tutorial, and that all seems to work OK.
I have also created a standalone Lambda Function that successfully accesses the AWS-SDK to display some EC2 instance information (see below).
// Standalone Lambda Function that Works OK
const AWS = require('aws-sdk')
AWS.config.update({region: 'eu-west-2'});
const ec2 = new AWS.EC2();
exports.handler = async function(event) {
return ec2.describeInstances().promise();
}
The problem I’m having is combining the two: that is accessing the aws-sdk from a SAM application. What isn’t helping is that when I try and use one of the pre-provided SAM templates that do access the aws-sdk (e.g. the S3 one), they won’t even build.
So I guess I have two basic questions:
Is SAM the answer to being able to run and debug Node.js applications locally?
And if so, how do I get a working SAM application that uses the ‘aws-sdk’?
I’m on the latest version of everything. Node.js, SAM CLI, etc. The development machine is an ubuntu VM running on an ubuntu host. But the non aws-sdk example seems to work fine.
Example of the example SAM application not building.
$ sam init
Which template source would you like to use?
1 - AWS Quick Start Templates
2 - Custom Template Location
Choice: 1
What package type would you like to use?
1 - Zip (artifact is a zip uploaded to S3)
2 - Image (artifact is an image uploaded to an ECR image repository)
Package type: 1
Which runtime would you like to use?
1 - nodejs14.x
2 - python3.8
3 - ruby2.7
4 - go1.x
5 - java11
6 - dotnetcore3.1
7 - nodejs12.x
8 - nodejs10.x
9 - python3.7
10 - python3.6
11 - python2.7
12 - ruby2.5
13 - java8.al2
14 - java8
15 - dotnetcore2.1
Runtime: 1
Project name [sam-app]: sam-app-sdk-test
Cloning app templates from https://github.com/aws/aws-sam-cli-app-templates
AWS quick start application templates:
1 - Hello World Example
2 - Step Functions Sample App (Stock Trader)
3 - Quick Start: From Scratch
4 - Quick Start: Scheduled Events
5 - Quick Start: S3
6 - Quick Start: SNS
7 - Quick Start: SQS
8 - Quick Start: Web Backend
Template selection: 5
-----------------------
Generating application:
-----------------------
Name: sam-app-sdk-test
Runtime: nodejs14.x
Dependency Manager: npm
Application Template: quick-start-s3
Output Directory: .
Next steps can be found in the README file at ./sam-app-sdk-test/README.md
The build errors
sam build
Building codeuri: /media/sf_Virtual-machine-shr/DEV-Projects/OaC/sam-app-sdk-test runtime: nodejs14.x metadata: {} functions: ['S3Json
LoggerFunction']
Running NodejsNpmBuilder:NpmPack
Running NodejsNpmBuilder:CopyNpmrc
Running NodejsNpmBuilder:CopySource
Running NodejsNpmBuilder:NpmInstall
Build Failed
Error: NodejsNpmBuilder:NpmInstall - NPM Failed: npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.c
om/request/request/issues/3142
npm WARN deprecated request-promise-native#1.0.9: request-promise-native has been deprecated because it extends the now deprecated req
uest package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {
"os":"linux","arch":"x64"})
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /home/peter/.npm/_logs/2021-04-25T14_35_13_711Z-debug.log
Turning the working Lambda Function Into a SAM Application
If I take my working Lambda Function and try to deploy it as a SAM application that builds and deploys OK, but won’t run.
Running locally
$ sam local invoke
Invoking app.lambdaHandler (nodejs14.x)
Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-nodejs14.x:rapid-1.22.0.
Mounting /media/sf_Virtual-machine-shr/DEV-Projects/OaC/backups/nc-sam-awsbackup-snapshots/.aws-sam/build/ShareSnapshotsFunction as /var/task:ro,delegated inside runtime container
START RequestId: bf15ac81-7d54-48ad-bbb7-df5e196c09f0 Version: $LATEST
2021-04-25T14:28:27.244Z undefined ERROR Uncaught Exception {"errorType":"Runtime.HandlerNotFound","errorMessage":"app.lambdaHandler is undefined or not exported","stack":["Runtime.HandlerNotFound: app.lambdaHandler is undefined or not exported"," at Object.module.exports.load (/var/runtime/UserFunction.js:144:11)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1063:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)"," at internal/main/run_main_module.js:17:47"]}
time="2021-04-25T14:28:27.252" level=panic msg="ReplyStream not available"
2021/04/25 14:28:27 http: panic serving 127.0.0.1:44020: &{0xc0000f4000 map[] 2021-04-25 14:28:27.252909676 +0000 UTC m=+0.322609308 panic <nil> ReplyStream not available <nil> <nil> }
goroutine 30 [running]:
<Stuff Cut Out>
2021-04-25T14:28:27.266Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"socket hang up","code":"ECONNRESET","stack":["Error: socket hang up"," at connResetException (internal/errors.js:607:14)"," at Socket.socketOnEnd (_http_client.js:493:23)"," at Socket.emit (events.js:327:22)"," at Socket.EventEmitter.emit (domain.js:467:12)"," at endReadableNT (internal/streams/readable.js:1327:12)"," at processTicksAndRejections (internal/process/task_queues.js:80:21)"]}
time="2021-04-25T14:28:27.288" level=error msg="Init failed" InvokeID= error="Runtime exited with error: exit status 129"
time="2021-04-25T14:28:27.288" level=error msg="INIT DONE failed: Runtime.ExitError"
Using "Invoke on AWS" from vscode.
Loading response...
Invocation result for arn:aws:lambda:eu-west-2:428829672862:function:nc-sam-awsbackup-snapshots-ShareSnapshotsFunction-Z9A1RR2GCQ9F
Logs:
START RequestId: f7a7d779-8ebd-4dde-987e-775f6116c2d4 Version: $LATEST
2021-04-25T14:21:24.159Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"EACCES: permission denied, open '/var/task/app.js'","code":"EACCES","errno":-13,"syscall":"open","path":"/var/task/app.js","stack":["Error: EACCES: permission denied, open '/var/task/app.js'"," at Object.openSync (fs.js:476:3)"," at Object.readFileSync (fs.js:377:35)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1090:18)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
END RequestId: f7a7d779-8ebd-4dde-987e-775f6116c2d4
REPORT RequestId: f7a7d779-8ebd-4dde-987e-775f6116c2d4 Duration: 1439.52 ms Billed Duration: 1440 ms Memory Size: 128 MB Max Memory Used: 14 MB
Unknown application error occurred
Error
Payload:
{"errorType":"Error","errorMessage":"EACCES: permission denied, open '/var/task/app.js'","trace":["Error: EACCES: permission denied, open '/var/task/app.js'"," at Object.openSync (fs.js:476:3)"," at Object.readFileSync (fs.js:377:35)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1090:18)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
Loading response...
Invocation result for arn:aws:lambda:eu-west-2:428829672862:function:nc-sam-awsbackup-snapshots-ShareSnapshotsFunction-Z9A1RR2GCQ9F
Logs:
START RequestId: 779c6351-0775-4f04-8a5e-987791b027bf Version: $LATEST
2021-04-25T14:31:26.397Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"EACCES: permission denied, open '/var/task/app.js'","code":"EACCES","errno":-13,"syscall":"open","path":"/var/task/app.js","stack":["Error: EACCES: permission denied, open '/var/task/app.js'"," at Object.openSync (fs.js:476:3)"," at Object.readFileSync (fs.js:377:35)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1090:18)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
END RequestId: 779c6351-0775-4f04-8a5e-987791b027bf
REPORT RequestId: 779c6351-0775-4f04-8a5e-987791b027bf Duration: 1449.59 ms Billed Duration: 1450 ms Memory Size: 128 MB Max Memory Used: 14 MB
Unknown application error occurred
Error
Payload:
{"errorType":"Error","errorMessage":"EACCES: permission denied, open '/var/task/app.js'","trace":["Error: EACCES: permission denied, open '/var/task/app.js'"," at Object.openSync (fs.js:476:3)"," at Object.readFileSync (fs.js:377:35)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1090:18)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
Running the Lambda Function within the AWS Console
Gives the same EACCES: permission denied

Experiencing difficulties running a gatsby project on yarn

I am trying to help a friend with its gatsby template, each time I tried to run the gatsby project, I get several errors.
C:\Users\Thosyn Pax\Desktop\Project\Sarvesh\Sarvesh\Superprops\Superprops>yarn gatsby-dev
yarn run v1.22.4
$ yarn workspace gatsby-landing run dev
$ gatsby develop
success open and validate gatsby-configs - 0.474s
success load plugins - 99.856s
success onPreInit - 0.400s
success initialize cache - 0.175s
success copy gatsby files - 1.584s
success onPreBootstrap - 3.519s
success createSchemaCustomization - 0.129s
success source and transform nodes - 16.371s
success building schema - 13.086s
success createPages - 0.022s
success createPagesStatefully - 2.229s
success onPreExtractQueries - 0.010s
success update schema - 0.379s
success extract queries from components - 39.358s
success write out requires - 0.879s
success write out redirect data - 0.019s
warn The icon(src/images/favicon.png) you provided to 'gatsby-plugin-manifest' is not
square.
The icons we generate will be square and for the best results we recommend you
success Build manifest and related icons - 2.713s
success onPostBootstrap - 2.757s
⠀
info bootstrap finished - 266.442s
⠀
ERROR
Processing C:/Users/Thosyn Pax/Desktop/Project/Sarvesh/Sarvesh/Superprops/Superprops/packages/common/src/assets/image/agency/blog/blog-img1.png failed
Original error:
WorkerError: Processing C:/Users/Thosyn Pax/Desktop/Project/Sarvesh/Sarvesh/Superpr ops/Superprops/packages/common/src/assets/image/agency/blog/blog-img1.png failed
Original error:
- jobs-manager.js:316 exports.enqueueJob
[Superprops]/[gatsby]/dist/utils/jobs-manager.js:316:23
- runMicrotasks
- task_queues.js:97 processTicksAndRejections
internal/process/task_queues.js:97:5
not finished run queries - 2.861s
not finished Generating image thumbnails - 2.512s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: C:\Program Files\nodejs\node.exe
Arguments: C:\Program Files (x86)\Yarn\lib\cli.js run dev
Directory: C:\Users\Thosyn Pax\Desktop\Project\Sarvesh\Sarvesh\Superprops\Superprops\packages\landing-gatsby
Output:
info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Html Webpack Plugin: Child Compilation Failed error in React page

I'm new to React, and I'm following a tutorial, and after a 'yarn start' command, I go to 'localhost:3000' and see this error appear:
Error: Child compilation failed:
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\buildin\glob al.js: Cannot find module './src/data'
It's the first step of the tutorial that has anything to do with React at all, so I don't see where could I have gone wrong, any ideas on what the problem might be would be very useful.
The full error is this:
Error: Child compilation failed:
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\buildin\glob al.js: Cannot find module './src/data'
Require stack:
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\helpers.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\get-modules-list-f or-target-version.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_modul es\#babel\preset-env\lib\polyfills\corejs3\entry-plugin.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_modul es\#babel\preset-env\lib\index.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\dependenci es.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\plug ins.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\inde x.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\index.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-loader\lib\index.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\loadLoader.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\LoaderRunner.js - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModule.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModuleFactory.j s
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\Compiler.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\webpack.js
- C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\react-scripts\scripts\start.js (W hile processing: "C:\\Users\\Iván\\PycharmProjects\\django_react\\django-todo-react\\frontend\\node_modules\\babel-pre set-react-app\\dependencies.js$0$9")
- loader.js:797 Function.Module._resolveFilename
internal/modules/cjs/loader.js:797:15
- loader.js:690 Function.Module._load
internal/modules/cjs/loader.js:690:27
- loader.js:852 Module.require
internal/modules/cjs/loader.js:852:19
- helpers.js:74 require
internal/modules/cjs/helpers.js:74:18
- helpers.js:3 Object.
[frontend]/[core-js-compat]/helpers.js:3:14
- loader.js:959 Module._compile
internal/modules/cjs/loader.js:959:30
- loader.js:995 Object.Module._extensions..js
internal/modules/cjs/loader.js:995:10
- loader.js:815 Module.load
internal/modules/cjs/loader.js:815:32
- loader.js:727 Function.Module._load
internal/modules/cjs/loader.js:727:14
- loader.js:852 Module.require
internal/modules/cjs/loader.js:852:19
- helpers.js:74 require
internal/modules/cjs/helpers.js:74:18
- get-modules-list-for-target-version.js:2 Object.
[frontend]/[core-js-compat]/get-modules-list-for-target-version.js:2:51
- loader.js:959 Module._compile
internal/modules/cjs/loader.js:959:30
- loader.js:995 Object.Module._extensions..js
internal/modules/cjs/loader.js:995:10
- loader.js:815 Module.load
internal/modules/cjs/loader.js:815:32
- Error: [BABEL] C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\buildin\gl obal.js: Cannot find module './src/data'
- Require stack:
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\helpers.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\get-modules-list -for-target-version.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_mod ules\#babel\preset-env\lib\polyfills\corejs3\entry-plugin.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_mod ules\#babel\preset-env\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\dependen cies.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\pl ugins.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\in dex.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-loader\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\loadLoader.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\LoaderRunner. js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModule.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModuleFactory .js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\Compiler.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\webpack.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\react-scripts\scripts\start.js (While processing: "C:\\Users\\Iván\\PycharmProjects\\django_react\\django-todo-react\\frontend\\node_modules\\babel -preset-react-app\\dependencies.js$0$9")
- Module build failed (from ./node_modules/babel-loader/lib/index.js):
- Error: [BABEL] C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\buildin\mo dule.js: Cannot find module './src/data'
- Require stack:
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\helpers.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\core-js-compat\get-modules-list -for-target-version.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_mod ules\#babel\preset-env\lib\polyfills\corejs3\entry-plugin.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\node_mod ules\#babel\preset-env\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-preset-react-app\dependen cies.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\pl ugins.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\config\files\in dex.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\#babel\core\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\babel-loader\lib\index.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\loadLoader.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\loader-runner\lib\LoaderRunner. js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModule.js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\NormalModuleFactory .js
- - C:\Users\Iván\PycharmProjects\django_react\django-todo-react\frontend\node_modules\webpack\lib\Compiler.js
I see three errors in total, all saying "Cannot find module './src/data'", so I guess there's that missing? In my project directory, I don't see anything called 'data' in the 'src' folder. Why could that be, or what should I add to fix it?
I think there is a bug in the core-js-combat version 3.4.6. This nasty bug is already fixed in version 3.4.7. So you can run npm install core-js-compat#3.4.7 --save .
temporary fix until the core-js-compat makes its way through all the repos:
npm i -s core-js-compat#3.4.7
Apparently this is related to a bad build of core-js-compat, which is a deep dependency of babel. These two posts have more information:
Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module './src/data'
I am getting an error of Html Webpack Plugin in reactjs
This is working for me you can also try this
npm install core-js-compat#3.4.7 --save

Resources