angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Different behavior on local and global angular-cli of the same version

Open yaahor opened this issue 9 years ago • 4 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Versions.

Local angular-cli version (node_modules\.bin\ng -v):

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.4
node: 6.9.2
os: win32 x64
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.0.4
@angular/compiler-cli: 4.1.3

Global angular-cli version (ng -v):

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.4
node: 6.9.2
os: win32 x64
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.0.4
@angular/compiler-cli: 4.1.3

Repro steps.

npm install autobahn --save
npm install @types/autobahn --save

Use "autobahn" in project.

If run ng build -prod, you can see that your project is built successfully. If run node_modules\.bin\ng build -prod, error will be thrown.

ERROR in vendor.c00f0a15a11c060eba86.bundle.js from UglifyJs
Unexpected token: name (Simple) [vendor.c00f0a15a11c060eba86.bundle.js:8889,6]

The log given by the failure.

Result of running node_modules\.bin\ng build -prod -sm:

ERROR in vendor.c00f0a15a11c060eba86.bundle.js from UglifyJs
Unexpected token: name (Simple) [./~/cbor/lib/simple.js:9,0][vendor.c00f0a15a11c060eba86.bundle.js:8889,6]

Desired functionality.

The same behavior of global and local angilar-cli of the same version

Mention any other details that might be useful.

"cbor" package is dependency of "autobahn".

Property "target" is set to "es5" in tsconfig.json.

tsconfig.app.json:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "baseUrl": "",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}

I have solved issue by using previous version of autobahn (0.11.2), but I can not understand why building by global ang local angular-cli of the same version behave differently.

yaahor avatar May 25 '17 07:05 yaahor

@yaahor can you try with @angular/[email protected]? https://github.com/angular/angular-cli/pull/6276 changed slightly, and I think yours might be one of the affected cases.

Also, when you run ng in a project folder it should use the local version. To check the global version, run ng -v outside a project folder.

filipesilva avatar Jun 01 '17 09:06 filipesilva

Hello have the same issue and using autobahn 17.5.1. Have you try each version between 17.5.1 and 0.11.2 ? update to 1.1.0 not solve my problem

Impossible to use flag --prod

Time: 35025ms
chunk    {0} polyfills.e9bbb65874590553bbf4.bundle.js (polyfills) 157 kB {4} [initial] [rendered]
chunk    {1} main.c86b19f5118b313bc28d.bundle.js (main) 625 kB {3} [initial] [rendered]
chunk    {2} styles.5d397e548b6185c076f0.bundle.css (styles) 175 bytes {4} [initial] [rendered]
chunk    {3} vendor.31635616814b238ac373.bundle.js (vendor) 6.04 MB [initial] [rendered]
chunk    {4} inline.b27dcce2ce883042554e.bundle.js (inline) 0 bytes [entry] [rendered]

ERROR in vendor.31635616814b238ac373.bundle.js from UglifyJs
Unexpected token: name (Simple) [vendor.31635616814b238ac373.bundle.js:16154,6]

codegastudio avatar Jun 19 '17 19:06 codegastudio

@yaahor @codegastudio Is this still an issue ?

Was able to follow your instructions with ng CLI 1.2.7, like so:

   ng new motorway
   cd motorway
   npm install autobahn --save
   npm install @types/autobahn --save

Both ng build -prod (A) and node_modules/.bin/ng build -prod (B) produce an app without errors. Both builds serve up a simple app with ng serve on http://localhost:4200. I removed the dist/ folder before building either app version (A & B).

Please confirm the issue is resolved by now.

catull avatar Aug 06 '17 19:08 catull

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.