下面是我创建第一个角度应用程序的步骤。

npm install -g @angular/cli和我在我的VSCode集成终端中收到了以下日志(我相信这很好)
> PS C:\Users\Babar Baig\Desktop\Angular> npm install -g @angular/cli
C:\Users\Babar Baig\AppData\Roaming\npm\ng ->
C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\@angular\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current:{"os":"win32","arch":"x64"})
+ @angular/cli@6.1.3
updated 1 package in 75.927s
PS C:\Users\Babar Baig\Desktop\Angular>
ng new appTwo创建我的应用程序。下面是我收到的日志和错误。
PS C:\Users\Babar Baig\Desktop\Angular> ng new appTwo
CREATE appTwo/angular.json (3548 bytes)
CREATE appTwo/package.json (1312 bytes)
CREATE appTwo/README.md (1023 bytes)
CREATE appTwo/tsconfig.json (408 bytes)
CREATE appTwo/tslint.json (2805 bytes)
CREATE appTwo/.editorconfig (245 bytes)
CREATE appTwo/.gitignore (503 bytes)
CREATE appTwo/src/favicon.ico (5430 bytes)
CREATE appTwo/src/index.html (293 bytes)
CREATE appTwo/src/main.ts (370 bytes)
CREATE appTwo/src/polyfills.ts (3194 bytes)
CREATE appTwo/src/test.ts (642 bytes)
CREATE appTwo/src/styles.css (80 bytes)
CREATE appTwo/src/browserslist (375 bytes)
CREATE appTwo/src/karma.conf.js (964 bytes)
CREATE appTwo/src/tsconfig.app.json (170 bytes)
CREATE appTwo/src/tsconfig.spec.json (256 bytes)
CREATE appTwo/src/tslint.json (314 bytes)
CREATE appTwo/src/assets/.gitkeep (0 bytes)
CREATE appTwo/src/environments/environment.prod.ts (51 bytes)
CREATE appTwo/src/environments/environment.ts (642 bytes)
CREATE appTwo/src/app/app.module.ts (314 bytes)
CREATE appTwo/src/app/app.component.html (1141 bytes)
CREATE appTwo/src/app/app.component.spec.ts (995 bytes)
CREATE appTwo/src/app/app.component.ts (210 bytes)
CREATE appTwo/src/app/app.component.css (0 bytes)
CREATE appTwo/e2e/protractor.conf.js (752 bytes)
CREATE appTwo/e2e/tsconfig.e2e.json (213 bytes)
CREATE appTwo/e2e/src/app.e2e-spec.ts (302 bytes)
CREATE appTwo/e2e/src/app.po.ts (208 bytes)
npm WARN deprecated istanbul-lib-hook@1.2.1: 1.2.0 should have been a major version bump
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! path C:\Users\Babar Baig\Desktop\Angular\appTwo\node_modules\acorn\bin\acorn
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod 'C:\Users\Babar Baig\Desktop\Angular\appTwo\node_modules\acorn\bin\acorn'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Babar Baig\AppData\Roaming\npm-cache\_logs\2018-08-12T05_56_04_185Z-debug.log
Package install failed, see above.
PS C:\Users\Babar Baig\Desktop\Angular>
这是我在谷歌上搜索了角斗士的项目创建问题之后所做的事情
npm install -g acorn安装了橡子,因为接收到了错误。但同样的错误再次发生。

npm install @angular/cli在本地文件夹“角”中安装角cli,然后执行新的项目命令ng new appTwo。没有取得任何进展。据我所知,"npm“无法从路径"C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\acorn\bin\acorn".”中找到'acorn‘在"node_modules“里面没有‘橡子’文件夹。但我不知道如何解决这个问题。
下面是命令运行的完整日志
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'acorn' ]
2 info using npm@5.6.0
3 info using node@v8.11.3
4 verbose npm-session 0648b6c8ae8267c4
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/acorn 896ms (from cache)
8 silly pacote tag manifest for acorn@latest fetched in 954ms
9 silly install loadIdealTree
10 silly install cloneCurrentTreeToIdealTree
11 silly install loadShrinkwrap
12 silly install loadAllDepsIntoIdealTree
13 silly resolveWithNewModule acorn@5.7.1 checking installable status
14 silly currentTree npm
15 silly idealTree npm
15 silly idealTree `-- acorn@5.7.1
16 silly install generateActionsToTake
17 silly diffTrees action count 1
18 silly diffTrees add acorn@5.7.1
19 silly decomposeActions action count 8
20 silly decomposeActions fetch acorn@5.7.1
21 silly decomposeActions extract acorn@5.7.1
22 silly decomposeActions preinstall acorn@5.7.1
23 silly decomposeActions build acorn@5.7.1
24 silly decomposeActions install acorn@5.7.1
25 silly decomposeActions postinstall acorn@5.7.1
26 silly decomposeActions finalize acorn@5.7.1
27 silly decomposeActions refresh-package-json acorn@5.7.1
28 silly install executeActions
29 silly doSerial global-install 8
30 verbose correctMkdir C:\Users\Babar Baig\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
31 verbose lock using C:\Users\Babar Baig\AppData\Roaming\npm-cache\_locks\staging-51cfd9b4628f34cb.lock for C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\.staging
32 silly doParallel extract 8
33 silly extract acorn@5.7.1
34 silly pacote trying acorn@https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz by hash: sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==
35 silly pacote acorn@https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz extracted to C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\.staging\acorn-4f034420 by content address 24ms
36 silly doReverseSerial unbuild 8
37 silly doSerial remove 8
38 silly doSerial move 8
39 silly doSerial finalize 8
40 silly finalize C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\acorn
41 silly doParallel refresh-package-json 8
42 silly refresh-package-json C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\acorn
43 silly doParallel preinstall 8
44 silly preinstall acorn@5.7.1
45 info lifecycle acorn@5.7.1~preinstall: acorn@5.7.1
46 silly doSerial build 8
47 silly build acorn@5.7.1
48 info linkStuff acorn@5.7.1
49 silly linkStuff acorn@5.7.1 has C:\Users\Babar Baig\AppData\Roaming\npm\node_modules as its parent node_modules
50 silly linkStuff acorn@5.7.1 is part of a global install
51 silly linkStuff acorn@5.7.1 is installed into a global node_modules
52 silly linkStuff acorn@5.7.1 is installed into the top-level global node_modules
53 verbose linkBins acorn@5.7.1
54 verbose linkBins [ { acorn: './bin/acorn' },
54 verbose linkBins 'C:\\Users\\Babar Baig\\AppData\\Roaming\\npm',
54 verbose linkBins true ]
55 verbose linkMans acorn@5.7.1
56 verbose unlock done using C:\Users\Babar Baig\AppData\Roaming\npm-cache\_locks\staging-51cfd9b4628f34cb.lock for C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\.staging
57 verbose stack Error: ENOENT: no such file or directory, chmod 'C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\acorn\bin\acorn'
58 verbose cwd C:\Users\Babar Baig\Desktop\Angular
59 verbose Windows_NT 10.0.17134
60 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "acorn"
61 verbose node v8.11.3
62 verbose npm v5.6.0
63 error path C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\acorn\bin\acorn
64 error code ENOENT
65 error errno -4058
66 error syscall chmod
67 error enoent ENOENT: no such file or directory, chmod 'C:\Users\Babar Baig\AppData\Roaming\npm\node_modules\acorn\bin\acorn'
68 error enoent This is related to npm not being able to find a file.
69 verbose exit [ -4058, true ]
我是从“\AppData\漫游\npm-缓存_日志”中找到的。任何帮助都将是非常感谢的,因为这是我第一次使用角度。
谢谢!
发布于 2018-08-23 16:53:13
我使用下面的链接来解决docs.npm问题。我执行npm cache clean --force来清理npm缓存。在清理npm缓存之后,我创建了一个新的角项目,它运行得非常好。
编码愉快!
https://stackoverflow.com/questions/51806324
复制相似问题