Angularjs2’s environmental problems have been solved for a long time.
Baidu’s answer is also a variety of also can not solve my problems.
Fortunately, these days after constant testing finally to solve.
ERROR in AppModule is not an NgModule
ERROR in ./src/main.ts
Module build failed: TypeError: Always read the property ‘newLine of undefined
at the Object. The getNewLineCharacter (d: \ web \ myNg \ ng2 \ node_modules \ typescript \ lib \ typescript js: 8062:20)
at the Object. The createCompilerHost (d:\web\myNg\ng2\node_modules\typescript\lib\typescript.js:44978:26)
at Object.ngcLoader (d:\web\myNg\ng2\node_modules@ngtools\webpack\src\loader.js:338:33)
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
ERROR in ./src/polyfills.ts
Module build failed: TypeError: Always read the property ‘newLine of undefined
at the Object. The getNewLineCharacter (d: \ web \ myNg \ ng2 \ node_modules \ typescript \ lib \ typescript js: 8062:20)
at the Object. The createCompilerHost (d:\web\myNg\ng2\node_modules\typescript\lib\typescript.js:44978:26)
at Object.ngcLoader (d:\web\myNg\ng2\node_modules@ngtools\webpack\src\loader.js:338:33)
@ multi ./src/polyfills.ts
webpack: Failed to compile.
This error is due to a local Typescript version conflict. But I don’t know why NPM is doing this. The web site says its mechanism is not supposed to cause version conflicts. It hasn’t been studied.
first:
$ npm ls typescript
Enter this command to see the Typescript version and dependencies of your project.
Two different versions have been found in various places.
Angular \ CLi relies on 2.1.6, which is automatically generated, so you can’t go to the node_module to find package.json. Can’t change. To give up.
[email protected] d: \ web \ myNg \ ng2
– – @ presents/[email protected] – & gt; D :\web\myNg\ node_modules.1.0.0-rc-1 @angular\cli
| ± -@angular /[email protected]
| | ± -@angular /[email protected]
| |>0 -- [email protected] deduped extraneous>1>2
— [email protected] extraneous
| ± -@angular /[email protected]
| | ± [email protected]
|>0>1 -- [email protected] extraneous>3
— [email protected] extraneous
>4 ±- @ngtools/[email protected]
| |-- [email protected] extraneous |
— [email protected]
‘– [email protected]
Then the other 2.0.10 is configured in the project’s package.json. This is angular/ CLI generated, but it’s in our own project, so it’s easy to change typescript to the angular/ CLI dependent version.
“Typescript” : “~2.0.0”
“change this to
” typescript “:” ~2.1.0 “
~ means that NPM automatically downloads the nearest smaller version. For example, it’s 2.1.6 on my computer. In this case, the Angular/CLI dependencies themselves are completely consistent.
again
$ npm ls typescript
Found that the version is consistent.
[email protected] d: \ web \ myNg \ ng2
– – @ presents/[email protected] – & gt; D :\web\myNg\ node_modules.1.0.0-rc.1@@angular\cli
| -- [email protected]
— [email protected] -> D: \ web \ myNg \ ng2 \ node_modules 2.1.6 @ typescript
$ ng serve
** NG Live Development Server is running on http://localhost:4200 **
Hash: b21dc5aadbb6f2b69213
Time: 10251ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 158 kB {4} [initial] [rendered]
chunk {1} main.bundle.js, Rendered]
chunk {3} vendor.js.map (main) 3.14 kB {3} [initial] [rendered]
chunk {2} styles. funds. js (styles) 9.84 kB {4} [initial] Version2.6 MB [initial] [br> chunk {4} invitation.js, ininvitation.js map (ininvitation.js) 0 bytes [entry] [rendered]
webpack: Compiled.
Get things done. I will make a note here in the hope that I can help others I meet later. After all, it’s such a waste of time.
Also, remember to use CNPM install when installing the environment. The native NPM Install will report an error because Node-Sass is blocked.
The original link: https://blog.csdn.net/yaerfeng/article/details/62610510
Read More:
- In idea, @ slf4j is used to report an error, but log is not found
- About error CSC in c# vs: error cs0006: metadata file could not be found
- [screen recording] an error is reported in the screenrecord command: inaccessible or not found
- Edit the file to be edited by GEDIT. After saving, the warning set document metadata failed: setting attribute metadata:: GEDIT position no appears
- Edit the file to be edited by gedit. After saving, a warning of Set document metadata failed: Setting attribute metadata::gedit-position no appears
- After Vue is packaged, a blank page appears, an error is reported in the resource request, and there is no error handling scheme
- Ant Design ‘cross env’ is not an internal or external command, nor is it an error reporting problem for a runnable program
- Android is Stuck in Download maven-metadata.xml [How to Solve]
- When Maven hits the jar package, an error is reported when executing install, and the symbol cannot be found in a line
- After verifying parameters with validation, springboot reports an error: no constructor found in package name + class name
- After node.js is installed, use the instruction node version in vscode to show that it is not an external or internal instruction. The solution is as follows:
- The echo introduced in react reports an error: xaxis “0” not found
- An error is reported when executing MVN. The diamond operator is not supported in source-1.5
- Error: [VueLoaderPlugin Error] No matching use for vue-loader is found. Make sure the rule matching
- After NPM run dev is running, the browser does not respond and reports an error in. / ~ / Babel loader / lib! / ~ / Vue loader / lib/ selector.js?type=script&in
- Error in publishing project with Maven in idea. Git directory is not found! Please specify a valid
- Syntax error: typeerror: this.getoptions is not a function an error is reported when the. SCSS file is imported globally
- An error is reported when the file in hive parquet format is written in the Flink connection
- Local workspace file (‘angular.json’) could not be found.