4

I followed steps from angular.io to install angular-cli and create a base project. It fails to serve or build every time. I removed npm, node, all node dep. still nothing. Getting the same error using different versions of angular-cli (beta28).

My ng -v

@angular/cli: 1.0.0-rc.1
node: 6.10.0
os: darwin x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.1
@angular/compiler-cli: 2.4.9

The errors I am getting:

ERROR in multi ./src/styles.css
Module not found: Error: Can't resolve 'style-loader' in '/Users/sebastian/workspace/ellipsis/frontend'
 @ multi ./src/styles.css

ERROR in multi ./src/main.ts
Module not found: Error: Can't resolve '@ngtools/webpack' in '/Users/sebastian/workspace/ellipsis/frontend'
 @ multi ./src/main.ts

ERROR in multi ./src/polyfills.ts
Module not found: Error: Can't resolve '@ngtools/webpack' in '/Users/sebastian/workspace/ellipsis/frontend'
     @ multi ./src/polyfills.ts
ERROR in   Error: Child compilation failed:
  Entry module not found: Error: Can't resolve 'raw-loader' in '/Users/sebastian/workspace/ellipsis/frontend':
  Error: Can't resolve 'raw-loader' in '/Users/sebastian/workspace/ellipsis/frontend'

So I installed one by one all needed modules. But than I am left with another error which is no longer a missing module.

I don't think it should be necessary to install this modules one by one. What am I missing here?

Running OSX Sierra

9
  • Try running webpack --display-error-details. The error may not be related to file resolution.github.com/webpack/webpack/issues/981 Commented Mar 7, 2017 at 22:42
  • Are you creating the project every time you re install angular-cli? Or you are using your own code base every time? Commented Mar 8, 2017 at 12:49
  • I am rm -rf project-name and ng new project-name cd -> ng build Commented Mar 8, 2017 at 13:10
  • have you tried update or use the > 6.9 version of node? Commented Mar 12, 2017 at 8:02
  • Is your local angular-cli version the same as your global cli version? Commented Mar 15, 2017 at 14:42

4 Answers 4

2

use @angular/cli instead

npm uninstall angular-cli

npm cache clean

npm install @angular/cli

ng new myApp

ng serve
Sign up to request clarification or add additional context in comments.

4 Comments

Getting exactly the same errors. I followed the steps from angular.io, yours are not much different, just reinstalling what I already had installed.
run these commands : npm install style-loader and npm install @ngtools/webpack and npm install raw-loader
Had to manually install bunch of other modules. All there, still errors: ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'newLine' of undefined at Object.getNewLineCharacter (/Users/sebastian/workspace/ellipsis/frontend/node_modules/typescript/lib/typescript.js:8062:20) at Object.createCompilerHost (/Users/sebastian/workspace/ellipsis/frontend/node_modules/typescript/lib/typescript.js:44978:26) at Object.ngcLoader (/Users/sebastian/workspace/ellipsis/frontend/node_modules/@ngtools/webpack/src/loader.js:338:33) @ multi ./src/main.ts
@Trouble the above should be an edit to your question.
1

I think you are still using rc version of cli, I am using below versions, please check and update if anything differs

"angular-cli": "1.0.0-beta.21",
"@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.1.0",

Comments

0

i believe if you clean the node modules and re install all should work fine.

Comments

0

If you had an older version of Node.js installed and then install the latest version.it will update the old version but still will be reffering old References.

Solution to this problem is to Uninstall older version of Node.js from add/remove programs and install a fresh instance of latest Node.js. then run "npm install -g @angular/cli" command prompt. it will install CLI components.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.