A2 CLI project runs locally but not remote after updating - angular2-cli

I recently updated my global A2 CLI, as well as an existing project, to:
_ _ _
__ _ _ __ __ _ _ _ | | __ _ _ __ ___ | |(_)
/ _` || '_ \ / _` || | | || | / _` || '__|_____ / __|| || |
| (_| || | | || (_| || |_| || || (_| || | |_____|| (__ | || |
\__,_||_| |_| \__, | \__,_||_| \__,_||_| \___||_||_|
|___/
#angular/cli: 1.0.0-beta.30
node: 7.4.0
os: darwin x64
#angular/common: 2.4.6
#angular/compiler: 2.4.6
#angular/core: 2.4.6
#angular/forms: 2.4.6
#angular/http: 2.4.6
#angular/platform-browser: 2.4.6
#angular/platform-browser-dynamic: 2.4.6
#angular/router: 3.4.6
#angular/cli: 1.0.0-beta.30
#angular/compiler-cli: 2.4.6
When I spin up ng serve on the project it runs fine but when I upload it to my vm I get the following errors:
[Error] SyntaxError: Unexpected token '<'
(anonymous function) (inline.bundle.js:1)
[Error] SyntaxError: Unexpected token '<'
(anonymous function) (polyfills.bundle.js:1)
[Error] ReferenceError: Can't find variable: webpackJsonp
Global Code (styles.bundle.js:1)
[Error] SyntaxError: Unexpected token '<'
(anonymous function) (vendor.bundle.js:1)
[Error] ReferenceError: Can't find variable: webpackJsonp
Global Code (main.bundle.js:1)
This morning I created a new project and uploaded it to the vm without additional changes, to see if it was something in the project update, and I get the same errors.
Pretty stumped on what's going on here. This is the first time I've encountered it and my projects have worked fine locally and remotely before updating.
The remote system is a Windows Server 2012 with XAMPP.
My local system is a Mac, usually running the app via ng serve, but checked with MAMP and it works under Apache there, too.
Has anyone run across this?

So evidently it had something to do with the directory. The app runs in a subdirectory on my vm and that hasn't posed a problem in the past. When I changed the bas href from "/" to "./", it worked again.

Related

Spark SQL CTE ignoring namespace in query

Running Spark locally spark-sql or through pyspark spark.sql(...), if I use a CTE in a query and then reference the CTE with an incorrect namespace / database, the query works just fine (unexpected). When I run the query in production (on Databricks), I get a Table or view not found error (expected).
Unexpected pass behavior can be reproduced locally via spark-sql:
WITH myview AS (
SELECT 1 AS column
)
SELECT
*
FROM
invalid_namespace.myview;
Which returns "1" when I expect it to fail.
Can someone help me make this fail locally so that we can properly test before we deploy?
Exact steps to reproduce from a terminal:
$ spark-sql
...
spark-sql> WITH some_new_cte AS (SELECT 1 AS column)
> SELECT * FROM namespace_does_not_exist.some_new_cte;
...
1
Time taken: 2.294 seconds, Fetched 1 row(s)
spark-sql>
If you look at the query plan, it actually failed to parse
== Parsed Logical Plan ==
CTE [myview]
: +- SubqueryAlias `myview`
: +- Project [1 AS column#0]
: +- OneRowRelation
+- 'Project [*]
+- 'UnresolvedRelation `invalid_namespace`.`myview`
== Analyzed Logical Plan ==
column: int
Project [column#0]
+- SubqueryAlias `myview`
+- Project [1 AS column#0]
+- OneRowRelation
== Optimized Logical Plan ==
Project [1 AS column#0]
+- OneRowRelation
== Physical Plan ==
*(1) Project [1 AS column#0]
+- Scan OneRowRelation[]
The reason your query returned "1" was because spark saw that your view was in the same query, so it just ignored your namespace. If the namespace really doesn't exist, it will fail.
This seems to be a bug that affects versions of Spark 2.4.0 through 2.4.5 (I did not check <2.4.0). It appears to have been fixed in 2.4.6 and continues to work as expected in 3.0.0.
Unexpected success in 2.4.0:
$ spark-submit --version
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 2.4.0
/_/
Using Scala version 2.11.12, OpenJDK 64-Bit Server VM, 1.8.0_262
Branch
Compiled by user on 2018-10-29T06:22:05Z
Revision
Url
Type --help for more information.
$ echo "WITH mycte AS (SELECT 1 AS column) SELECT * FROM bad_namespace.mycte;" | SPARK_CONF_DIR=spark_conf spark-sql
20/07/17 10:59:05 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Spark master: local[*], Application Id: local-1595008748636
spark-sql> WITH mycte AS (SELECT 1 AS column) SELECT * FROM bad_namespace.mycte;
1
Time taken: 1.822 seconds, Fetched 1 row(s)
spark-sql>
Tested but unshown: 2.4.1, 2.4.2, 2.4.3, 2.4.4 (all succeed unexpectedly)
Unexpected success in 2.4.5:
$ spark-submit --version
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 2.4.5
/_/
Using Scala version 2.11.12, OpenJDK 64-Bit Server VM, 1.8.0_262
Branch HEAD
Compiled by user centos on 2020-02-02T19:38:06Z
Revision cee4ecbb16917fa85f02c635925e2687400aa56b
Url https://gitbox.apache.org/repos/asf/spark.git
Type --help for more information.
$ echo "WITH mycte AS (SELECT 1 AS column) SELECT * FROM bad_namespace.mycte;" | SPARK_CONF_DIR=spark_conf spark-sql
20/07/17 10:59:55 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Spark master: local[*], Application Id: local-1595008798737
spark-sql> WITH mycte AS (SELECT 1 AS column) SELECT * FROM bad_namespace.mycte;
1
Time taken: 2.155 seconds, Fetched 1 row(s)
spark-sql>
Expected failure in 2.4.6:
$ spark-submit --version
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 2.4.6
/_/
Using Scala version 2.11.12, OpenJDK 64-Bit Server VM, 1.8.0_262
Branch HEAD
Compiled by user holden on 2020-05-29T23:47:51Z
Revision 807e0a484d1de767d1f02bd8a622da6450bdf940
Url https://gitbox.apache.org/repos/asf/spark.git
Type --help for more information.
$ echo "WITH mycte AS (SELECT 1 AS column) SELECT * FROM bad_namespace.mycte;" | SPARK_CONF_DIR=spark_conf spark-sql
20/07/17 11:00:40 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Spark master: local[*], Application Id: local-1595008843321
spark-sql> WITH mycte AS (SELECT 1 AS column) SELECT * FROM bad_namespace.mycte;
20/07/17 11:00:44 WARN ObjectStore: Failed to get database global_temp, returning NoSuchObjectException
20/07/17 11:00:44 WARN ObjectStore: Failed to get database bad_namespace, returning NoSuchObjectException
Error in query: Table or view not found: `bad_namespace`.`mycte`; line 1 pos 49;
'Project [*]
+- 'UnresolvedRelation `bad_namespace`.`mycte`
spark-sql>
Expected failure in 3.0.0:
$ spark-submit --version
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 3.0.0
/_/
Using Scala version 2.12.10, OpenJDK 64-Bit Server VM, 1.8.0_262
Branch HEAD
Compiled by user ubuntu on 2020-06-06T11:32:25Z
Revision 3fdfce3120f307147244e5eaf46d61419a723d50
Url https://gitbox.apache.org/repos/asf/spark.git
Type --help for more information.
$ echo "WITH mycte AS (SELECT 1 AS column) SELECT * FROM bad_namespace.mycte;" | SPARK_CONF_DIR=spark_conf spark-sql
20/07/17 11:01:40 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
20/07/17 11:01:42 WARN HiveConf: HiveConf of name hive.stats.jdbc.timeout does not exist
20/07/17 11:01:42 WARN HiveConf: HiveConf of name hive.stats.retries.wait does not exist
20/07/17 11:01:44 ERROR ObjectStore: Version information found in metastore differs 1.2.0 from expected schema version 2.3.0. Schema verififcation is disabled hive.metastore.schema.verification
20/07/17 11:01:44 WARN ObjectStore: setMetaStoreSchemaVersion called but recording version is disabled: version = 2.3.0, comment = Set by MetaStore georgeleslie-waksman#10.0.1.178
Spark master: local[*], Application Id: local-1595008901594
spark-sql> WITH mycte AS (SELECT 1 AS column) SELECT * FROM bad_namespace.mycte;
20/07/17 11:01:45 WARN ObjectStore: Failed to get database global_temp, returning NoSuchObjectException
20/07/17 11:01:45 WARN ObjectStore: Failed to get database bad_namespace, returning NoSuchObjectException
Error in query: Table or view not found: bad_namespace.mycte; line 1 pos 49;
'Project [*]
+- 'UnresolvedRelation [bad_namespace, mycte]
spark-sql>

Error when run gulp start

I'm searching and searching and I can´t find the error.
Now I hope someone help me.
npm -v
[18:54:13] Requiring external module babel-core/register
[18:54:13] CLI version 3.9.0
[18:54:13] Local version 3.9.0
gulp -v
5.6.0
$ gulp start
[18:47:59] Requiring external module babel-core/register
/node_modules/babel-core/lib/transformation/file/index.js:558
throw err;
^
SyntaxError: /config/index.js: Unexpected token (31:17)
29 | const bothConfig = require('./both');
30 |
> 31 | export default { ...bothConfig, ...envConfig };
| ^
32 |
at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1761:8)
at Parser.pp$3.parseIdentifier (/node_modules/babylon/lib/index.js:4332:10)
at Parser.pp$3.parsePropertyName (/node_modules/babylon/lib/index.js:4156:96)
at Parser.parsePropertyName (/node_modules/babylon/lib/index.js:6229:23)
at Parser.pp$3.parseObj (/node_modules/babylon/lib/index.js:4045:12)
at Parser.pp$3.parseExprAtom (/node_modules/babylon/lib/index.js:3719:19)
at Parser.parseExprAtom (/node_modules/babylon/lib/index.js:7238:22)
at Parser.pp$3.parseExprSubscripts (/node_modules/babylon/lib/index.js:3494:19)
at Parser.pp$3.parseMaybeUnary (/node_modules/babylon/lib/index.js:3474:19)
export default{bothConfig, envConfig};

Errors after installing '#babel/preset-env'

when I was trying to start my npm project I got the following error:
/home/projects/reactive-weather/reactive-weather/app/node_modules/expo/src/Location.js:
Cannot find module '#babel/preset-env' from '/home/projects/reactive-weather/reactive-weather/app'
Surely I need to install this module but after I did, I'm getting this error:
Error: /home/projects/reactive-weather/reactive-weather/app/node_modules/expo/src/Location.js: Unexpected token, expected ";" (9:5)
7 | const LocationEventEmitter = new NativeEventEmitter(NativeModules.ExponentLocation);
8 |
> 9 | type ProviderStatus = {
| ^
10 | locationServicesEnabled: boolean,
11 | gpsAvailable: ?boolean,
12 | networkAvailable: ?boolean,
10:43:44 AM: Failed building JavaScript bundle
Everything was perfectly fine, the last thing I've done before this happened was using git commands like: git stash also I had to perform npm audit fix but I don't think any libs were vulnerable.

Getting Angular: error with latest version

I want to migrate my app angular4 to angular5, but it's looks ng version have some issue with latest version.
Any Idea what is the stable version for angular5. #angular/cli.
Step I followed:
Installed latest version of node 8.9.1
npm install -g #angular/cli#latest
ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.5.5
Node: 8.9.1
OS: darwin x64
Angular: error
... animations, cli, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router
typescript: error
webpack: error
it's work after install npm install typescript#2.4.2 --save-exact ...
Thanks.! – Umang Savaliya Dec 7 '17 at 9:34
Solved in their comments by checking the dependencies are up to date.
npm install typescript#2.4.2 --save-exact with Angular 5.1 with Angular-CLI v1.6.0
Resolve this issue.

ng cli generate component with module broken

I'm using the ng cli for the first time. I'm trying to make a new module ('foo') and a new component ('bar') under the foo module. Though, how I think I'm supposed to do it in ng cli doesn't seem to work:
mbp:my-new-app chris$ ng g m foo
installing module
create src/app/foo/foo.module.ts
mbp:my-new-app chris$ ng g c bar -m foo
installing component
create src/app/bar/bar.component.scss
create src/app/bar/bar.component.html
create src/app/bar/bar.component.spec.ts
create src/app/bar/bar.component.ts
EISDIR: illegal operation on a directory, read
Error: EISDIR: illegal operation on a directory, read
at Error (native)
at Object.fs.readSync (fs.js:732:19)
at tryReadSync (fs.js:487:20)
at Object.fs.readFileSync (fs.js:535:19)
at Class.afterInstall (/Users/chris/code/my-new-app/node_modules/#angular/cli/blueprints/component/index.js:209:34)
at tryCatch (/Users/chris/code/my-new-app/node_modules/rsvp/dist/rsvp.js:539:12)
at invokeCallback (/Users/chris/code/my-new-app/node_modules/rsvp/dist/rsvp.js:554:13)
at publish (/Users/chris/code/my-new-app/node_modules/rsvp/dist/rsvp.js:522:7)
at flush (/Users/chris/code/my-new-app/node_modules/rsvp/dist/rsvp.js:2414:5)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
ng cli version:
mbp:my-new-app chris$ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
#angular/cli: 1.0.0
node: 6.10.1
os: darwin x64
#angular/common: 4.0.1
#angular/compiler: 4.0.1
#angular/core: 4.0.1
#angular/forms: 4.0.1
#angular/http: 4.0.1
#angular/platform-browser: 4.0.1
#angular/platform-browser-dynamic: 4.0.1
#angular/router: 4.0.1
#angular/cli: 1.0.0
#angular/compiler-cli: 4.0.1
Am I doing using this wrong? I haven't found documentation specifically on this feature.
Thanks!
instead of running
ng g c bar -m foo
try to run (without -m)
ng g c foo/bar
if you want to reference a module, which should export/import your new component, you should provide a relative path to this module, like:
ng g c bar -m foo/foo.module
in this case bar component will be imported/exported by foo.module, but located under src/app.
EASDIR error occurred because you provided a directory (foo) instead of file (foo/foo.module)
as answered for example here:
EISDIR means that the target of the operation is a directory in reality but that the expected filetype of the target is something other than a directory.