在windows上使用npm在Cli中创建一个新的angular项目时遇到的问题。

问题描述 投票:0回答:2

所以,我跟着一个udemy angular课程,讲师是用mac而我用windows。当我创建一个新的项目,我从他得到不同的屏幕是正常的,或者我错过了什么。这些屏幕都是附件,我的是黑屏。我得到了一系列的创建命令,然后是一系列的警告。

其后是一个成功初始化的git

他得到一系列的创造也

但随后是一系列的安装

    A:\Work\Projects> ng new first-website
? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? CSS
CREATE first-website/angular.json (3622 bytes)
CREATE first-website/package.json (1289 bytes)
CREATE first-website/README.md (1029 bytes)
CREATE first-website/tsconfig.json (489 bytes)
CREATE first-website/tslint.json (3125 bytes)
CREATE first-website/.editorconfig (274 bytes)
CREATE first-website/.gitignore (631 bytes)
CREATE first-website/browserslist (429 bytes)
CREATE first-website/karma.conf.js (1025 bytes)
CREATE first-website/tsconfig.app.json (210 bytes)
CREATE first-website/tsconfig.spec.json (270 bytes)
CREATE first-website/src/favicon.ico (948 bytes)
CREATE first-website/src/index.html (298 bytes)
CREATE first-website/src/main.ts (372 bytes)
CREATE first-website/src/polyfills.ts (2835 bytes)
CREATE first-website/src/styles.css (80 bytes)
CREATE first-website/src/test.ts (753 bytes)
CREATE first-website/src/assets/.gitkeep (0 bytes)
CREATE first-website/src/environments/environment.prod.ts (51 bytes)
CREATE first-website/src/environments/environment.ts (662 bytes)
CREATE first-website/src/app/app.module.ts (314 bytes)
CREATE first-website/src/app/app.component.html (25725 bytes)
CREATE first-website/src/app/app.component.spec.ts (963 bytes)
CREATE first-website/src/app/app.component.ts (217 bytes)
CREATE first-website/src/app/app.component.css (0 bytes)
CREATE first-website/e2e/protractor.conf.js (808 bytes)
CREATE first-website/e2e/tsconfig.json (214 bytes)
CREATE first-website/e2e/src/app.e2e-spec.ts (646 bytes)
CREATE first-website/e2e/src/app.po.ts (301 bytes)
√ Packages installed successfully.
warning: LF will be replaced by CRLF in .editorconfig.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in angular.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in browserslist.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/protractor.conf.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/src/app.e2e-spec.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/src/app.po.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in e2e/tsconfig.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in karma.conf.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in package-lock.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in package.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.component.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.component.spec.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.component.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/app/app.module.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/environments/environment.prod.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/environments/environment.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/index.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/main.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/polyfills.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/styles.css.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/test.ts.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tsconfig.app.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tsconfig.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tsconfig.spec.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in tslint.json.
The file will have its original line endings in your working directory
    Successfully initialized git.
angular git npm command-line-interface
2个回答
0
投票

你可以忽略这些警告。在我印象中,它们与git有关。当我几个月前参加他的Angular课程时,我使用Win 10 Pro没有任何问题。

你是否使用vs代码终端来安装clinpm?

这是他的课程内容1.5中关于解决安装问题的信息。

通过确保你使用最新版本的NodeJS、npm和CLI本身,很多问题都可以解决。

更新NodeJS。

到nodejs.org下载最新版本--先卸载机器上的(所有)安装版本。

更新npm。

运行[sudo] npm install -g npm (sudo是Mac Linux上才需要的)

更新CLI

[sudo] npm uninstall -g angular-cli @angularcli

npm缓存验证

[sudo] npm install -g @angularcli

以下是一些常见的问题& 解决方案。

创建一个新项目需要很长时间(超过3分钟),这在Windows上时常发生 => 尝试以管理员身份运行命令行。

你得到一个EADDR错误(地址已经在使用中) 你可能已经有另一个ng serve进程在运行--确保退出该进程或使用ng serve --port ANOTHERPORT在一个新的端口上服务你的项目。

我的更改没有反映在浏览器中(应用程序没有编译) 检查运行ng serve的窗口是否显示错误。如果不是这样,请确保您使用的是最新的CLI版本,并尝试重新启动您的CLI。

希望能帮到你


0
投票

我想这是Windows的标准,使用两个字节作为回行。

这只是意味着创建的文件将被修改,以更好地适应你所使用的操作系统的标准。

没什么好担心的。

© www.soinside.com 2019 - 2024. All rights reserved.