Error when try run angular-fullstack client boilerplate - node.js

I'm build my first Angular project and i followed the angular-fullstack guide.
info:
Angular Fullstack v5.0.0-rc.4
Out of the box I create an Angular app with an Express server.
# Client
? What would you like to write scripts with? Babel
? Would you like to use Flow types with Babel? No
? What would you like to write markup with? HTML
? What would you like to write stylesheets with? CSS
? Would you like to include Bootstrap? No
# Server
? What would you like to use for data modeling? (Press <space> to select, <a> to toggle all, <i> to invert selection)Mongoose (MongoDB)
? Would you scaffold out an authentication boilerplate? No
? Would you like to use WebSockets? No
# Project
? What would you like to write tests with? Mocha + Chai + Sinon
? What would you like to write Chai assertions with? Expect
The full log is very extensive and can be find here.
when i start the server with npm run start:server its connect to my MongoDB and works perfectly but when starts the client(npm run start:client) the follow error occurs
ERROR in ./client/app/main/main.component.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: user_path/pokemon-manager/client/app/main/main.component.js: Unexpected token, expected , (21:30)
19 | ngOnInit() {
20 | return this.http.get('/api/things')
> 21 | .subscribe((things: []) => {
| ^
22 | this.awesomeThings = things;
23 | });
24 | }
# ./client/app/main/main.module.js 22:12-39
# ./client/app/app.module.js
# ./client/app/app.js
Child html-webpack-plugin for "..\client\app.html":
Asset Size Chunks Chunk Names
../client/app.html 28.6 KiB 0
Entrypoint undefined = ../client/app.html
i 「wdm」: Failed to compile.
this can be find fully here

Related

Yarn with Webpack: how to use a TypeScript .ts file that is in an outer Node directory not managed by Yarn/Webpack?

I'm working on a k6 (https://k6.io/) load testing project that uses Yarn and Webpack.
It lives as a "sub-project" / sub-folder within a larger project/repo. The larger project uses npm Node modules.
I need to grab a secret from AWS's Secrets Manager in my k6 load testing project. There's a TypeScript Secrets Manager client already in the larger/outside project.
I naively tried importing it:
import SecretsManagerClient from "../../helpers/SecretsManagerClient";
and using it:
const value = await SecretsManagerClient.getSecret("fooSecretName");
And I get all kinds of errors like:
Module parse failed: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
and:
SyntaxError: /foo/helpers/SecretsManagerClient.ts: Unexpected token (7:10)
5 | class SecretsManagerClient {
6 |
> 7 | private client;
| ^
Is what I'm trying to do possible? Do I need to change settings in webpack.config.js?
My awesome coworker found this resource which may work for us:
https://github.com/grafana/k6-jslib-aws

Running FFMPEGJS in a React Project

I'm trying to get https://github.com/ffmpegjs/ffmpeg.js/ running in a Create React App build project.
import {createWorker} from '#ffmpeg/ffmpeg';
When I import the library the build fails with
./node_modules/#ffmpeg/ffmpeg/src/createWorker.js
Module parse failed: Unexpected token (21:4)
You may need an appropriate loader to handle this file type.
| logger,
| progress,
| ...options
| } = resolvePaths({
| ...defaultOptions,
I'm not sure how to handle this, or where the problem might be. Is this a Webpack issue?

AVA Test Runner Setup with Create React App Boilerplate

Trying to setup AVA after running create-react-app. There are a few tutorials and references of this gist I've found and tried, but I keep getting an unexpected token error on the JSX <App /> element. Anyone know what is wrong with that gist? Full output of npm run test:
react-with-ava#0.1.0 test /react-with-ava
cross-env NODE_ENV=test ava
1 exception
Uncaught Exception
SyntaxError: /react-with-ava/src/App.test.js: Unexpected token (8:18)
SyntaxError: /react-with-ava/src/App.test.js: Unexpected token (8:18)
6 | test('renders without crashing', t => {
7 | const div = document.createElement('div');
8 | ReactDOM.render(<App />, div);
| ^
9 | });
It is neither supported nor recommended to use Ava with Create React App.
The created project already contains a test runner (Jest) which we recommend to use. Run npm test in the project folder to start.
In theory you could get Ava to work but this would require configuring Babel which will get confusing in a CRA project very quickly. If you insist on using Ava you can npm run eject and then replace Jest with Ava manually in the ejected project.

Possible to run AVA tests inside a node server?

I want users to submit code and run tests against that code using AVA. The AVA CLI seems great. But this would be running in a hosted environment like Heroku and need to respond back to the POST request containing the code submission with the results of the unit tests.
When I try var test = require('ava') and then call the test function in a route, I get this message when starting the node server:
[OKAY] Loaded ENV .env File as KEY=VALUE Format
10:24:11 PM web.1 | Test files must be run with the AVA CLI:
10:24:11 PM web.1 | $ ava index.js
[DONE] Killing all processes with signal null
10:24:11 PM web.1 Exited with exit code 1
I think it is not possible, it is thought to be used through the cli. Actually to me it does not make much sense for it be used as a required module in your code.
How did you plan to use it? If you just want to use the assertions you can use some assertion library like chai, expect or power-assert.
If you want more information opening an issue in the AVA repo also could be an option.

Node Webkit - Tried to load Twitter Bootstrap, "Uncaught Node.js Error"

I am a total beginner on node.js, I wanted to experiment with it a bit.
I followed the instructions on building a node webkit app. When I edit index.html, I added <script src="js/bootstrap.js"></script> and it threw the error and displayed a cloud floating around:
Uncaught node.js Error
TypeError: undefined is not a function
at file:///C:/Users/Daniel/Desktop/node-webkit/js/bootstrap.js:158:7
at file:///C:/Users/Daniel/Desktop/node-webkit/js/bootstrap.js:160:2
Bootstrap.js:
| +function ($) {
| ...
ln 158 | $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
| ...
ln 160 | }(jQuery);
Other than these lines, there are still a bunch of error lines, but it seems to display 2 at a time.
I do not want to invoke any node.js functions or methods, is there something in bootstrap that conflicts with node webkit?
Twitter Bootstrap's requires jQuery. It seems like you forgot to include it. You should download it and insert <script src="jquery-1.11.0.min.js"></script> right before where you include bootstrap.js.

Resources