I have an Angular 11.x app that I run using npm run start - this has worked fine for months but all of a sudden it is no longer running the command and I am getting the following errors, can anyone suggest how I fix this? I have tried the obvious ideas of deleting node_modules and reinstalling them using npm install but with no joy.
Below is the error I get after running npm run start - what have I done to break this :(
Compiling #angular/core : es2015 as esm2015
Error: Error on worker #1: TypeError: Cannot read property 'map' of undefined
at injectDependencies (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler/bundles/compiler.umd.js:6960:21)
at compileFactoryFunction (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler/bundles/compiler.umd.js:6888:61)
at Object.compileInjector (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler/bundles/compiler.umd.js:8106:22)
at NgModuleDecoratorHandler.compileFull (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/src/ngtsc/annotations/src/ng_module.js:427:44)
at _loop_2 (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/src/ngtsc/transform/src/compilation.js:595:39)
at NgccTraitCompiler.TraitCompiler.compile (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/src/ngtsc/transform/src/compilation.js:626:21)
at DecorationAnalyzer.compileFile (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:225:53)
at DecorationAnalyzer.analyzeProgram (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:164:45)
at Transformer.analyzeProgram (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/packages/transformer.js:135:57)
at Transformer.transform (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/packages/transformer.js:77:27)
at ClusterMaster.onWorkerMessage (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/execution/cluster/master.js:195:27)
at /Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/execution/cluster/master.js:55:95
at ClusterMaster.<anonymous> (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/execution/cluster/master.js:293:57)
at step (/Users/zabius/Sites/abc-ui-ng4/node_modules/tslib/tslib.js:143:27)
at Object.next (/Users/zabius/Sites/abc-ui-ng4/node_modules/tslib/tslib.js:124:57)
at /Users/zabius/Sites/abc-ui-ng4/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
at Object.__awaiter (/Users/zabius/Sites/abc-ui-ng4/node_modules/tslib/tslib.js:113:16)
at EventEmitter.<anonymous> (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/execution/cluster/master.js:287:32)
at EventEmitter.emit (events.js:315:20)
An unhandled exception occurred: NGCC failed.
See "/private/var/folders/b2/1zfdxz293d944p_lxk9_ypz40000gn/T/ng-XQcM3b/angular-errors.log" for further details.
The error in the angular-errors.log file is as follows -
[error] Error: NGCC failed.
at NgccProcessor.process (/Users/zabius/Sites/abc-ui-ng4/node_modules/#ngtools/webpack/src/ngcc_processor.js:129:19)
at /Users/zabius/Sites/abc-ui-ng4/node_modules/#ngtools/webpack/src/angular_compiler_plugin.js:593:31
at SyncHook.eval [as call] (eval at create (/Users/zabius/Sites/abc-ui-ng4/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10$
at SyncHook.lazyCompileHook (/Users/zabius/Sites/abc-ui-ng4/node_modules/webpack/node_modules/tapable/lib/Hook.js:154:20)
at Object.webpack [as webpackFactory] (/Users/zabius/Sites/abc-ui-ng4/node_modules/webpack/lib/webpack.js:55:30)
at createWebpack (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-webpack/src/webpack-dev-server/index.js:21:36)
at Object.runWebpackDevServer (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-webpack/src/webpack-dev-server/index.js:47:12)
at SwitchMapSubscriber.project (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-angular/src/dev-server/index.js:209:32)
at SwitchMapSubscriber._next (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-angular/node_modules/rxjs/internal/operators/swit$
at SwitchMapSubscriber.Subscriber.next (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-angular/node_modules/rxjs/internal/Subs$
at /Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-angular/node_modules/rxjs/internal/util/subscribeToPromise.js:7:24
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Versions :
npm -v 8.1.0
node -v 14.15.4
Using MacOS BigSur 11.5.2
A year ago I've made a project for a course: https://github.com/GeorgeFlorian/Finished_link_project
Now, I am trying to make it work on my machine, but I have no luck.
I've got npm 7.13.0 and node 16.1.0.
I've ran npm update in order to update all the depencies.
Steps
I've cloned the repo into a PC than runs Linux Mint 20.1
I've ran npm install
npm update
npm run build and npm run serve return the same error:
georgeflorian#georgeflorian-desktop:~/New Volume/VSCode Projects/Finished_link_project$ npm run build
> proiect-link#0.1.0 build
> vue-cli-service build
⠧ Building for production...
ERROR Failed to compile with 1 error 2:55:41 PM
Syntax Error: TypeError: Cannot read property 'parseComponent' of undefined
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR Build failed with errors.
I have no idea how to trace the error: Syntax Error: TypeError: Cannot read property 'parseComponent' of undefined.
Also, the NodeJS server won't start:
georgeflorian#georgeflorian-desktop:~/New Volume/VSCode Projects/Finished_link_project/server$ node app.js
node:internal/fs/utils:343
throw err;
^
Error: ENOENT: no such file or directory, stat '/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/dist/favicon.ico'
at Object.statSync (node:fs:1527:3)
at resolveSync (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/node_modules/serve-favicon/index.js:187:17)
at favicon (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/node_modules/serve-favicon/index.js:61:12)
at Object.<anonymous> (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/server/app.js:46:9)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/dist/favicon.ico'
}
I believe that many dependencies are deprecated, but this begs two questions:
If it worked back then and it hasn't been touched since, why doesn't it work now ?
How can I fix all the deprecated dependencies if npm update did not fix them ?
Ultimately, I would like to learn how to approach this kind of situation. Thank you.
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
I'm trying to start a new project in React Native but I'm getting errors when I try to launch iOS Simulator. I have not edited the index.ios.js. I'm using iOS Simulator to run the project, and the error in the emulator is 'Could not connect to development server...'
Looking for JS files in /Users/jeff/Documents/TestApp
ERROR EACCES, permission denied '/Users/jeff/.babel.json'
{"errno":-13,"code":"EACCES","path":"/Users/jeff/.babel.json","syscall":"open"}
Error: EACCES, permission denied '/Users/jeff/.babel.json'
at Error (native)
at Object.fs.openSync (evalmachine.:500:18)
at Object.fs.writeFileSync (evalmachine.:1099:15)
at save (/Users/jeff/Documents/TestApp/node_modules/react-native/node_modules/babel-core/lib/api/register/cache.js:35:19)
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions. evalmachine.:565
fs.write = function(fd, buffer, offset, length, position, callback) {
^ Error: EACCES, permission denied '/Users/jeff/.babel.json'
at Error (native)
at Object.fs.openSync (evalmachine.:500:18)
at Object.fs.writeFileSync (evalmachine.:1099:15)
at process.save (/Users/jeff/Documents/TestApp/node_modules/react-native/node_modules/babel-core/lib/api/register/cache.js:35:19)
at process.emit (events.js:107:17)
at process.exit (node.js:600:17)
at process. (/Users/jeff/Documents/TestApp/node_modules/react-native/packager/packager.js:143:11)
at process.emit (events.js:107:17)
at process._fatalException (node.js:236:26) Process terminated. Press to close the window
I had fixed this problem, and execute the following command
sudo chmod 777 ~/.babel.json
and then re-init the react-native project, it will be successful.
You can try just
nvm alias default iojs-v2
If that doesn't work try going through all the steps in the installation guide again. Then in your project folder
rm -rf node_modules/
npm i
In Xcode remove RCTWebSocketDebugger from your libraries:
YourProject > Libraries > RCTWebSocketDebugger
Then in Xcode Product -> Clean and try building again
Giving the admin permissions to the path ~/.babel.json should help. Try with this command:
sudo chmod 777 ~/.babel.json
I want to create a Krakenjs app whit the next command: yo kraken , but thw console give me the next error:
Stack trace:
Error: EACCES, open '/home/erik/.cache/bower/packages/64c3d861bd88c012885cd73d2f0e6a53-2.1.14.lock'
Console trace: Trace
at StandardRenderer.error (/usr/lib/node_modules/bower/lib/renderers/StandardRenderer.js:72:17)
at Logger.<anonymous> (/usr/lib/node_modules/bower/bin/bower:110:22)
at Logger.emit (events.js:95:17)
at Logger.emit (/usr/lib/node_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)
at /usr/lib/node_modules/bower/lib/commands/index.js:40:20
at _rejected (/usr/lib/node_modules/bower/node_modules/q/q.js:797:24)
at /usr/lib/node_modules/bower/node_modules/q/q.js:823:30
at Promise.when (/usr/lib/node_modules/bower/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/usr/lib/node_modules/bower/node_modules/q/q.js:741:41)
at /usr/lib/node_modules/bower/node_modules/q/q.js:557:44
System info:
Bower version: 1.3.9
Node version: 0.10.30
OS: Linux 3.13.0-32-generic x64
You've probably got items in ~/.cache/ owned by root. This happens when you run bower with sudo. You shouldn't need to do that.
Fix the permissions -- probably sudo chown -R youruser ~/.cache/