OS: Windows 10 Pro
NPM Version: 3.8.6
So, I'm attempting to build a project with npm build but no project build output folder is generated, and the following error logs are generated:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm- cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm#3.8.6
3 info using node#v6.1.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle learn-redux#1.0.0~prebuild: learn-redux#1.0.0
6 silly lifecycle learn-redux#1.0.0~prebuild: no script for prebuild, continuing
7 info lifecycle learn-redux#1.0.0~build: learn-redux#1.0.0
8 verbose lifecycle learn-redux#1.0.0~build: unsafe-perm in lifecycle true
9 verbose lifecycle learn-redux#1.0.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\d0475\Documents\Projects\learn-redux\node_modules\.bin;C:\Program Files\nodejs;C:\Users\d0475\Documents\Cmder\bin;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\share\vim\vim74;C:\Users\d0475\Documents\Cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\Users\d0475\Documents\Cmder\vendor\conemu-maximus5;C:\Users\d0475\Documents\Cmder\vendor\conemu-maximus5\ConEmu;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\GNU\GnuPG\pub;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\Calibre2\;C:\Users\d0475\AppData\Local\Microsoft\WindowsApps;C:\Users\d0475\AppData\Roaming\npm;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\d0475\AppData\Local\Microsoft\WindowsApps;;C:\Users\d0475\Documents\Cmder
10 verbose lifecycle learn-redux#1.0.0~build: CWD: C:\Users\d0475\Documents\Projects\learn-redux
11 silly lifecycle learn-redux#1.0.0~build: Args: [ '/d /s /c', 'npm run clean && npm run build:webpack' ]
12 silly lifecycle learn-redux#1.0.0~build: Returned: code: 1 signal: null
13 info lifecycle learn-redux#1.0.0~build: Failed to exec build script
14 verbose stack Error: learn-redux#1.0.0 build: `npm run clean && npm run build:webpack`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:850:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid learn-redux#1.0.0
16 verbose cwd C:\Users\d0475\Documents\Projects\learn-redux
17 error Windows_NT 10.0.14986
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
19 error node v6.1.0
20 error npm v3.8.6
21 error code ELIFECYCLE
22 error learn-redux#1.0.0 build: `npm run clean && npm run build:webpack`
22 error Exit status 1
23 error Failed at the learn-redux#1.0.0 build script 'npm run clean && npm run build:webpack'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the learn-redux package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error npm run clean && npm run build:webpack
23 error You can get information on how to open an issue for this project with:
23 error npm bugs learn-redux
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls learn-redux
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
My package.json reads as follows:
"scripts": {
"build:webpack": "NODE_ENV=production webpack --config webpack.config.prod.js",
"build": "npm run clean && npm run build:webpack",
"test": "NODE_ENV=production mocha './tests/**/*.spec.js' --compilers js:babel-core/register",
"clean": "rimraf dist",
"start": "node devServer.js"
},
and my webpack.config.prod.js reads as follows:
var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'source-map',
entry: [
'./client/reduxstagram'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': "'production'"
}
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
})
],
module: {
loaders: [
// js
{
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, 'client')
},
// CSS
{
test: /\.styl$/,
include: path.join(__dirname, 'client'),
loader: 'style-loader!css-loader!stylus-loader'
}
]
}
};
What is the issue here?
The issue was resolved by changing:
"build:webpack": "NODE_ENV=production webpack --config webpack.config.prod.js",
to
"build:webpack": "set NODE_ENV=production && webpack --config webpack.config.prod.js",
I had the same problem and sometimes it is not so much the code.
Sometimes where you put the "main.js" and "app.js" files they go in the "src" folder of your project!
The file "main.js" is copied in the folder "src" and in that same folder is the sub-folder "components" "app.js"
That was the solution to my problem!
Related
I have a generic SAM application generated by AWS Toolkit.
My end goal is to debug my go application line by line.
Sorry if this question gets too long, but I have tried my best to add as few relevant details as possible, while trying to make sure I don't miss anything important.
I am using the default launch.json configurations generated by the Toolkit:
{
"configurations": [
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "sunflowers:HelloWorldFunction (go1.x)",
"invokeTarget": {
"target": "template",
"templatePath": "${workspaceFolder}/template.yaml",
"logicalId": "HelloWorldFunction"
},
"lambda": {
"payload": {},
"environmentVariables": {},
"runtime": "go1.x"
}
},
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "API sunflowers:HelloWorldFunction (go1.x)",
"invokeTarget": {
"target": "api",
"templatePath": "${workspaceFolder}/template.yaml",
"logicalId": "HelloWorldFunction"
},
"api": {
"path": "/hello",
"httpMethod": "get",
"payload": {
"json": {}
}
},
"lambda": {
"runtime": "go1.x"
}
}
]
}
But when I run sunflowers:HelloWorldFunction (go1.x), I get the following error in the AWS Toolkit output:
could not launch process: fork/exec /var/task/hello-world: function not implemented
Full error Log:
2022-08-04 18:41:12 [INFO]: Preparing to debug locally: Lambda "hello-world"
2022-08-04 18:41:12 [INFO]: Building SAM application...
2022-08-04 18:41:12 [INFO]: Command: (not started) [/opt/homebrew/bin/sam build --build-dir /tmp/aws-toolkit-vscode/vsctky6JmVn/output --template /Users/varungawande/playground/goLambdaDebug/sunflowers/template.yaml]
2022-08-04 18:41:13 [INFO]: Your template contains a resource with logical ID "ServerlessRestApi", which is a reserved logical ID in AWS SAM. It could result in unexpected behaviors and is not recommended.
2022-08-04 18:41:13 [INFO]: Building codeuri: /Users/varungawande/playground/goLambdaDebug/sunflowers/hello-world runtime: go1.x metadata: {} architecture: x86_64 functions: HelloWorldFunction
2022-08-04 18:41:13 [INFO]: Running GoModulesBuilder:Build
2022-08-04 18:41:13 [INFO]:
Build Succeeded
2022-08-04 18:41:13 [INFO]:
Built Artifacts : ../../../../../private/tmp/aws-toolkit-vscode/vsctky6JmVn/output
Built Template : ../../../../../private/tmp/aws-toolkit-vscode/vsctky6JmVn/output/template.yaml
Commands you can use next
=========================
[*] Validate SAM template: sam validate
[*] Invoke Function: sam local invoke -t ../../../../../private/tmp/aws-toolkit-vscode/vsctky6JmVn/output/template.yaml
[*] Test Function in the Cloud: sam sync --stack-name {stack-name} --watch
[*] Deploy: sam deploy --guided --template-file ../../../../../private/tmp/aws-toolkit-vscode/vsctky6JmVn/output/template.yaml
2022-08-04 18:41:14 [INFO]: Build complete.
2022-08-04 18:41:14 [INFO]: Starting SAM application locally
2022-08-04 18:41:14 [INFO]: AWS.running.command
Invoking hello-world (go1.x)
Skip pulling image and use local one: public.ecr.aws/sam/emulation-go1.x:rapid-1.53.0-x86_64.
Mounting /tmp/aws-toolkit-vscode/vsctky6JmVn/output/HelloWorldFunction as /var/task:ro,delegated inside runtime container
START RequestId: 8cc3eb7a-20f2-4599-81bc-2f29f8d02102 Version: $LATEST
API server listening at: [::]:5858
2022-08-04T13:11:16Z warning layer=rpc Listening for remote connections (connections are not authenticated nor encrypted)
2022-08-04T13:11:16Z info layer=debugger launching process with args: [/var/task/hello-world]
2022-08-04 18:41:16 [INFO]: Waiting for SAM application to start...
could not launch process: fork/exec /var/task/hello-world: function not implemented
2022/08/04 13:11:16 exit status 1
04 Aug 2022 13:11:16,067 [ERROR] (rapid) Init failed error=Runtime exited with error: exit status 1 InvokeID=
API server listening at: [::]:5858
2022-08-04T13:11:16Z warning layer=rpc Listening for remote connections (connections are not authenticated nor encrypted)
2022-08-04T13:11:16Z info layer=debugger launching process with args: [/var/task/hello-world]
could not launch process: fork/exec /var/task/hello-world: function not implemented
2022/08/04 13:11:16 exit status 1
END RequestId: 0dcb2785-a232-41aa-8f78-f61c82add96b
REPORT RequestId: 0dcb2785-a232-41aa-8f78-f61c82add96b Init Duration: 1.26 ms Duration: 838.60 ms Billed Duration: 839 ms Memory Size: 128 MB Max Memory Used: 128 MB
2022-08-04 18:41:17 [INFO]: Attaching debugger to SAM application...
Command stopped: "sam local invoke"
2022-08-04 18:41:23 [ERROR]: Retry limit reached while trying to attach the debugger.
2022-08-04 18:41:23 [ERROR]: Unable to attach Debugger. Check AWS Toolkit logs. If it took longer than expected to start, you can still attach.
sam local start-api and sam local invoke still work.
The path they mounted at /tmp/aws-toolkit-vscode/vsctky6JmVn/output/HelloWorldFunction does have the file they're looking for.
❯ tree /tmp/aws-toolkit-vscode/vsctky6JmVn/output/HelloWorldFunction
/tmp/aws-toolkit-vscode/vsctky6JmVn/output/HelloWorldFunction
└── hello-world
The hello-world program does have a main function:
package main
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
var (
// DefaultHTTPGetAddress Default Address
DefaultHTTPGetAddress = "https://checkip.amazonaws.com"
// ErrNoIP No IP found in response
ErrNoIP = errors.New("No IP in HTTP response")
// ErrNon200Response non 200 status code in response
ErrNon200Response = errors.New("Non 200 Response found")
)
func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
str := "Hello World"
str = exclaim(str)
for i := 3; i < 30; i++ {
str = exclaim(str)
fmt.Println(str, "at", i)
}
resp, err := http.Get(DefaultHTTPGetAddress)
if err != nil {
return events.APIGatewayProxyResponse{}, err
}
if resp.StatusCode != 200 {
return events.APIGatewayProxyResponse{}, ErrNon200Response
}
ip, err := ioutil.ReadAll(resp.Body)
if err != nil {
return events.APIGatewayProxyResponse{}, err
}
if len(ip) == 0 {
return events.APIGatewayProxyResponse{}, ErrNoIP
}
return events.APIGatewayProxyResponse{
Body: fmt.Sprintf("Hello, %v", string(ip)),
StatusCode: 200,
}, nil
}
func main() {
lambda.Start(handler)
}
func exclaim(str string) string {
return str + "!"
}
Note: I'm on a Mac, using the M1 chip(Arch: arm64) but the build-file is being executed for x86-64.
hello-world: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=O4tsTAbXATrthCbExZYS/IcUitw8QuK2KVYZ9ln5Y/QZl7mLeZv6TDrrYMwafh/81ITMlD5ZHrz3gae1BfY, with debug_info, not stripped```
Since it can find the file, Does this mean that the executor can't find the main?
I used the VS Code AWS Toolkit and SAM to create a basic SAM web app based on Go(I VS Code generate it).
It's some generic template code for the Lambda that reads IP from request and returns a Hello <IP> on the browser.
My end goal is to manage to see line by line debugging on my lambda function in VS Code.
There seem to be some default configurations in my launch.json:
{
"configurations": [
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "sunflowers:HelloWorldFunction (go1.x)",
"invokeTarget": {
"target": "template",
"templatePath": "${workspaceFolder}/sunflowers/template.yaml",
"logicalId": "HelloWorldFunction"
},
"lambda": {
"payload": {},
"environmentVariables": {},
"runtime": "go1.x"
}
},
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "API sunflowers:HelloWorldFunction (go1.x)",
"invokeTarget": {
"target": "api",
"templatePath": "${workspaceFolder}/sunflowers/template.yaml",
"logicalId": "HelloWorldFunction"
},
"api": {
"path": "/hello",
"httpMethod": "GET",
"payload": {
"json": {}
}
},
"lambda": {
"runtime": "go1.x"
}
}
]
}
However on clicking the "Start Debugging" button, I get that error that it can't install delve:
2022-08-03 21:20:46 [ERROR]: log level: info
2022-08-03 21:20:47 [INFO]: Retrieving AWS endpoint data
2022-08-03 21:20:47 [INFO]: OS: Darwin arm64 21.6.0
2022-08-03 21:20:47 [INFO]: Visual Studio Code extension host: 1.69.2
2022-08-03 21:20:47 [INFO]: AWS Toolkit: 1.46.0
2022-08-03 21:20:47 [INFO]: node: 16.13.2
2022-08-03 21:20:47 [INFO]: electron: 18.3.5
2022-08-03 21:21:49 [WARN]: SAM debug: missing AWS credentials (Toolkit is not connected)
2022-08-03 21:21:50 [INFO]: autoconnect: connected: 'profile:default'
2022-08-03 21:21:50 [INFO]: Command: (not started) [/Users/varungawande/Library/Application Support/Code/User/globalStorage/amazonwebservices.aws-toolkit-vscode/debuggers/delve/install-1.9.0.sh ]
2022-08-03 21:21:50 [ERROR]: Failed to cross-compile Delve debugger: Error: spawn Unknown system error -8
at ChildProcess.spawn (node:internal/child_process:412:11)
at Object.spawn (node:child_process:718:9)
at Function.l [as spawn] (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:27:9212)
at /Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:1734:1495
at new Promise (<anonymous>)
at cc.run (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:1734:1099)
at AH (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2076:252)
at _H (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2075:195)
at E6.invokeConfig (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2082:5965)
at E6.makeAndInvokeConfig (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2082:1314)
at E6.resolveDebugConfigurationWithSubstitutedVariables (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2082:1202) {
errno: -8,
code: 'Unknown system error -8',
syscall: 'spawn'
}
2022-08-03 21:22:27 [INFO]: Command: (not started) [/Users/varungawande/Library/Application Support/Code/User/globalStorage/amazonwebservices.aws-toolkit-vscode/debuggers/delve/install-1.9.0.sh ]
2022-08-03 21:22:27 [ERROR]: Failed to cross-compile Delve debugger: Error: spawn Unknown system error -8
at ChildProcess.spawn (node:internal/child_process:412:11)
at Object.spawn (node:child_process:718:9)
at Function.l [as spawn] (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:27:9212)
at /Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:1734:1495
at new Promise (<anonymous>)
at cc.run (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:1734:1099)
at AH (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2076:252)
at _H (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2075:195)
at E6.invokeConfig (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2082:5965)
at E6.makeAndInvokeConfig (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2082:1314)
at E6.resolveDebugConfigurationWithSubstitutedVariables (/Users/varungawande/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-1.46.0/dist/src/main.js:2082:1202) {
errno: -8,
code: 'Unknown system error -8',
syscall: 'spawn'
}
2022-08-03 21:25:49 [INFO]: telemetry: sent batch (size=5)
My lambda requires the architecture amd64, while my Mac has the M1 chip, so it has an architecture of arm64. Is the above error due to this architecture mismatch?
I tried running the lambda locally using docker and that worked(using sam local start-api and sam local invoke), but am not sure the above with work as smoothly when using a debugger.
Turns out this is due to a bug in AWS Toolkit extension of VS Code. It was fixed in AWS Toolkit 1.47.
I have a web application which I want to deploy on AWS amplify.
I am very new to this, following the procedure, I always get a build error (command ng build not found)
My app builds perfectly on local machine, and all the files are transferred to GIT repository.
The app uses AppSync and Aurora as well.
Any help would be much appreciated.
{
"name": "new-impact",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "[ -f src/aws-exports.js ] && mv src/aws-exports.js src/aws-exports.ts || ng serve; ng serve",
"build": "[ -f src/aws-exports.js ] && mv src/aws-exports.js src/aws-exports.ts || node ./node_modules/#angular/cli/bin/ng build --prod; node ./node_modules/#angular/cli/bin/ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "~9.0.3",
"#angular/common": "~9.0.3",
"#angular/compiler": "~9.0.3",
"#angular/core": "~9.0.3",
"#angular/forms": "~9.0.3",
"#angular/localize": "^9.1.0",
"#angular/platform-browser": "~9.0.3",
"#angular/platform-browser-dynamic": "~9.0.3",
"#angular/router": "~9.0.3",
"#ng-bootstrap/ng-bootstrap": "^6.0.2",
"apollo-angular": "^1.8.0",
"apollo-angular-link-http": "^1.9.0",
"apollo-boost": "^0.4.7",
"apollo-cache-inmemory": "^1.6.0",
"apollo-client": "^2.6.8",
"apollo-env": "^0.6.2",
"apollo-link": "^1.2.13",
"aws-amplify": "^2.3.0",
"aws-appsync": "^3.0.2",
"d3-scale": "^3.2.1",
"d3plus": "^2.0.0-alpha.25",
"graphql": "^14.6.0",
"graphql-tag": "^2.10.3",
"ngx-chips": "^2.1.0",
"ngx-pagination": "^5.0.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.900.4",
"#angular/cli": "~9.0.4",
"#angular/compiler-cli": "~9.0.3",
"#angular/language-service": "~9.0.3",
"#types/jasmine": "~3.5.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~5.18.0",
"typescript": "~3.7.5"
}
}
// Build error
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid new-impact#0.0.0
15 verbose cwd /codebuild/output/src651454953/src/test
16 verbose Linux 4.14.165-103.209.amzn1.x86_64
17 verbose argv "/root/.nvm/versions/node/v10.16.0/bin/node" "/root/.nvm/versions/node/v10.16.0/bin/npm" "run" "build"
18 verbose node v10.16.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error new-impact#0.0.0 build: `[ -f src/aws-exports.js ] && mv src/aws-exports.js src/aws-exports.ts || node ./node_modules/#angular/cli/bin/ng build --prod; node ./node_modules/#angular/cli/bin/ng build --prod`
22 error Exit status 1
23 error Failed at the new-impact#0.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
2020-05-04T21:58:06.455Z [ERROR]: !!! Build failed
2020-05-04T21:58:06.507Z [ERROR]: !!! Non-Zero Exit Code detected
2020-05-04T21:58:06.507Z [INFO]: # Starting environment caching...
2020-05-04T21:58:06.507Z [INFO]: # Environment caching completed
Terminating logging...
There can be a number of reasons, but it might be this one:
(if not, could you update your question with your package.json file and the build error from the amplify console?)
The amplify console will run node run build when it starts the build and not the angular cli, ng build.
You need to update the build script in your package.json file so that node run build will run ng build:
...
"scripts" : {
...
"start": "[ -f src/aws-exports.js ] && mv src/aws-exports.js src/aws-exports.ts || ng serve; ng serve",
"build": "[ -f src/aws-exports.js ] && mv src/aws-exports.js src/aws-exports.ts || node ./node_modules/#angular/cli/bin/ng build --prod; node ./node_modules/#angular/cli/bin/ng build --prod",
...
}
This include automatic renaming of your aws-exports file from aws-exports.js to aws-exports.ts if you have forgotten to rename it manually.
The line node ./node_modules/#angular/cli/bin/ng build --prod; is the line needed to make aws amplify console to build your angular app correctly.
I came across the same problem of having build issues on AWS Amplify. I found out I had dependencies with different versions in package-lock-json. I tried running
npm ci and it fixed the problem.
I am new to AWS CodePipeline and I am getting this Error on AWS CodeBuild
"YAML_FILE_ERROR Message: Wrong number of container tags, expected 1"
I have setup AWS CodePipeline with CodeBuild and CloudFormation for aspnet core 2.1 project. Here is my buildspec.yml
{
"name": "Utility",
"source": {
"type": "S3",
"location": "<location>/windows-dotnetcore.zip"
},
"artifacts": {
"type": "S3",
"location": "<location>",
"packaging": "ZIP",
"name": "Utility.zip"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/dot-net:core-2.1",
"computeType": "BUILD_GENERAL1_SMALL"
},
"serviceRole": "<value>",
"encryptionKey": "<value>"
}
This happened for me when I omitted the first 'version' line from yml:
version: 0.2
I received this error when I had a blank buildspec.yml checked in to CodeCommit. Once I updated it with something like this I was good to go:
version: 0.2
phases:
install:
commands:
- echo Installing Mocha...
- npm install -g mocha
pre_build:
commands:
- echo Installing source NPM dependencies...
- npm install unit.js
build:
commands:
- echo Build started on `date`
- echo Compiling the Node.js code
- mocha HelloWorld.js
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- HelloWorld.js
Out of curiosity I thought it might have been a formatting error, but I tried checking in some garbage text and received the following error instead:
Phase context status code: YAML_FILE_ERROR Message: stat
New to TACO and I'm following the Getting Started with TACO-CLI. Sadly I am getting an error when running this create command:
taco create hello
Here's the error I'm getting:
$ taco create hello
Downloading: taco-kits
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\kyle\AppData\Roaming\taco_home\node_modules\taco-kits\latest\package.json'
npm WARN latest No description
npm WARN latest No repository field.
npm WARN latest No README data
npm WARN latest No license field.
taco-kits downloaded and installed.
Error: Cannot find module 'C:\Users\kyle\AppData\Roaming\taco_home\node_modules\taco-kits\latest\node_modules\taco-kits'
SyntaxError: Unexpected token ILLEGAL
I have these versions of stuff:
npm 3.9.6
taco 1.2.1
node 6.2.1
Windows 10 (latest updates)
I've also tried with the latest stable version of node (4.4.5) and no joy.
Indeed, the contents of 'C:\Users\kyle\AppData\Roaming\taco_home\node_modules\taco-kits\latest\' does not contain a package.json file. Here's what I see there:
node_modules
timestamp.txt
The 'C:\Users\kyle\AppData\Roaming\taco_home\node_modules\taco-kits\latest\node_modules\taco-kits' contains this:
LICENSE
TacoKitMetadata.json
node_modules
package.json
resources
tacoErrorCodes.js
tacoErrorHelper.js
tacoKits.js
templates
test
The package.json file in that folder contains the following:
{
"name": "taco-kits",
"description": "Validated Kits metadata for taco CLI",
"version": "1.2.0",
"author": {
"name": "Microsoft Corporation",
"email": "vscordovatools-admin#microsoft.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Microsoft/TACO.git"
},
"bugs": {
"url": "https://github.com/Microsoft/TACO/issues",
"email": "vscordovatools-admin#microsoft.com"
},
"homepage": "http://taco.tools",
"main": "tacoKits.js",
"scripts": {
"test": "mocha",
"coverage": "istanbul cover --report json node_modules/mocha/bin/_mocha -- --reporter spec"
},
"dependencies": {
"q": "^1.1.2",
"taco-utils": "^1.3.3"
},
"devDependencies": {
"mocha": "2.0.1",
"istanbul": "^0.4.0",
"should": "4.3.0",
"taco-tests-utils": "^0.1.4"
},
"license": "MIT",
"_id": "taco-kits#1.2.0",
"_shasum": "7e9281a34e59cfb64234057e6ada10a99791a6ef",
"_resolved": "https://registry.npmjs.org/taco-kits/-/taco-kits-1.2.0.tgz",
"_from": "taco-kits#latest",
"_npmVersion": "2.14.9",
"_nodeVersion": "0.12.9",
"_npmUser": {
"name": "vsmobile",
"email": "vscordovatools-admin#microsoft.com"
},
"dist": {
"shasum": "7e9281a34e59cfb64234057e6ada10a99791a6ef",
"tarball": "https://registry.npmjs.org/taco-kits/-/taco-kits-1.2.0.tgz"
},
"maintainers": [
{
"name": "vsmobile",
"email": "vscordovatools-admin#microsoft.com"
}
],
"directories": {}
}
Any help would be appreciated.
Update (resolved)
I was able to resolve this issue by deleting the taco-kits folder and then running taco kit list which reinstalled the kits. The bash commands I used are as follows (using bash):
rm -Rf /c/users/kyle/AppData/Roaming/taco_home/node_modules/taco-kits/
taco kit list
I'd suggest just renaming that taco-kits folder first just to make sure it works for you.