Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install angular-cli locally from a fork on github? #3840

Closed
aegyed91 opened this issue Jan 3, 2017 · 9 comments
Closed

How to install angular-cli locally from a fork on github? #3840

aegyed91 opened this issue Jan 3, 2017 · 9 comments

Comments

@aegyed91
Copy link

aegyed91 commented Jan 3, 2017

Please provide us with the following information:

OS?

Linux (ubuntu 1604)

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.24
node: 6.9.2
os: linux x64
@angular/common: 2.4.1
@angular/compiler: 2.4.1
@angular/core: 2.4.1
@angular/forms: 2.4.1
@angular/http: 2.4.1
@angular/platform-browser: 2.4.1
@angular/platform-browser-dynamic: 2.4.1
@angular/router: 3.4.1
@angular/compiler-cli: 2.4.1
@ngtools/webpack: 1.2.1

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

The command i am trying to run is: ./node_modules/.bin/ng build --prod

using a fork: https://github.com/TechTeamer/angular-cli which is up to date with master and got these small modifications: master...TechTeamer:master

The project originally was created with angular-cli: 1.0.0-beta.24 installed globally.

This fork functions correct if i do npm link steps as stated in the readme. The problem is, i am not allowed to install a global package to the production server. That is why i cannot do npm link.

What i did is:

"@angular-cli/base-href-webpack": "file:./packages/@angular-cli/base-href-webpack",
"@ngtools/webpack": "file:./packages/@ngtools/webpack"

and generated those files with the build npm script

  • this is where i am atm, with the ERROR in AppModule is not an NgModule error

The log given by the failure.

Normally this include a stack trace and some more information.

> ./node_modules/.bin/ng build --prod

Hash: 96a1809b453efc9987ea
Time: 7080ms
chunk    {0} styles.bundle.css, styles.bundle.map, styles.bundle.map (styles) 246 kB {2} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.map (main) 527 bytes [initial] [rendered]
chunk    {2} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in AppModule is not an NgModule

ERROR in ./frontend/main.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
    at Object.getNewLineCharacter (/workspace/telenet-partner/node_modules/angular-cli/node_modules/typescript/lib/typescript.js:8062:20)

    at Object.createCompilerHost (/workspace/telenet-partner/node_modules/angular-cli/node_modules/typescript/lib/typescript.js:44978:26)

    at Object.ngcLoader (/workspace/telenet-partner/node_modules/angular-cli/packages/@ngtools/webpack/src/loader.ts:192:31)
 @ multi main

ping @hansl


Thanks! We'll be in touch soon.

@aegyed91 aegyed91 changed the title How to install angular-cli locally from a for on github? How to install angular-cli locally from a fork on github? Jan 3, 2017
@clydin
Copy link
Member

clydin commented Jan 3, 2017

ng serve is not intended for production use. It's strongly advised to use a security hardened server for production scenarios.

@aegyed91
Copy link
Author

aegyed91 commented Jan 3, 2017

we are planning to use the build step, updated the command to make it less misleading

get the same error with the build command too

my guess is, some metadata is not being emitted to the compiler

@clydin
Copy link
Member

clydin commented Jan 3, 2017

Generally, if you're using a fork, you're kind of on your own in terms of troubleshooting.
The error you're receiving is usually caused by a mismatch of angular versions.

@aegyed91
Copy link
Author

aegyed91 commented Jan 3, 2017

@clydin maybe you are right, but if u check #3781 this guy has a very similar error

something with the @ngtools/webpack loader .ts file during compilation

ps: replacing @ngtools/webpack-loader with ts-loader generates a different error :D

@hansl
Copy link
Contributor

hansl commented Jan 4, 2017

Don't install the CLI from a GitHub branch; it wasn't built that way. Instead, clone it locally and link it (npm link, then npm link blah from your project). Bootstrapping does not work properly if it's inside a node_modules itself. Since the file structure for developing is very different than the one on npm, that's to be expected and we use require hacks to make it work properly. Closing this as solved (just follow instructions in the developing guide).

@hansl hansl closed this as completed Jan 4, 2017
@aegyed91
Copy link
Author

aegyed91 commented Jan 4, 2017

@hansl i am not allowed to install an npm package globally

it is in the issue: "The problem is, i am not allowed to install a global package to the production server. That is why i cannot do npm link."I cannot do https://docs.npmjs.com/getting-started/fixing-npm-permissions#option-2-change-npms-default-directory-to-another-directory either.

where can i see the require hacks?

@izoomi
Copy link

izoomi commented Mar 8, 2017

Any update on this?

@e-hein
Copy link

e-hein commented May 19, 2017

Had exactly the same problem - solved it. What I did:

  1. checkout angular cli in one directory and do the npm install
  2. checkout the project (which uses the forked cli) in another directory and do the npm install

resulting in a structure like this:

buildfolder
|- customized-angular-cli
\- my-project

  1. stay in the my-project folder and launch the build process like this:
    ../customized-angular-cli/bin/ng build --prod -bh "/my-base-href/"

worked without any npm link :-)

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants