我能够安装nodejs版本v10.7.0和npm版本6.1.0,而没有任何问题。还安装了angular 1.7.2和打字稿2.9.2。在尝试安装npm install -g @ angular / cli @ latest时,出现以下错误。
我尝试了所有可以在线找到的调试步骤,包括强制清除缓存以及安装和卸载nodejs以及将我的system32文件夹添加到PATH变量中。我认为这篇文章对我很有帮助-How do you install angular-cli for windows 7
7904 info lifecycle @schematics/angular@0.6.8~postinstall: @schematics/angular@0.6.8
7905 silly postinstall @schematics/update@0.6.8
7906 info lifecycle @schematics/update@0.6.8~postinstall: @schematics/update@0.6.8
7907 silly postinstall opn@5.3.0
7908 info lifecycle opn@5.3.0~postinstall: opn@5.3.0
7909 silly postinstall resolve@1.8.1
7910 info lifecycle resolve@1.8.1~postinstall: resolve@1.8.1
7911 silly postinstall silent-error@1.1.0
7912 info lifecycle silent-error@1.1.0~postinstall: silent-error@1.1.0
7913 silly postinstall symbol-observable@1.2.0
7914 info lifecycle symbol-observable@1.2.0~postinstall: symbol-observable@1.2.0
7915 silly postinstall yargs-parser@10.1.0
7916 info lifecycle yargs-parser@10.1.0~postinstall: yargs-parser@10.1.0
7917 silly postinstall @angular/cli@6.0.8
7918 info lifecycle @angular/cli@6.0.8~postinstall: @angular/cli@6.0.8
7919 verbose lifecycle @angular/cli@6.0.8~postinstall: unsafe-perm in lifecycle true
7920 verbose lifecycle @angular/cli@6.0.8~postinstall: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Nidhin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\.bin;C:\Users\Nidhin\AppData\Roaming\npm\node_modules\.bin;C:\Windows\System32;C:\Users\Nidhin\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\Nidhin\AppData\Local\Programs\Python\Python37\;C:\Users\Nidhin\AppData\Local\Programs\Fiddler;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs\;C:\Users\Nidhin\AppData\Roaming\npm;C:\Windows\System32;C:\Windows\System32;C:\Users\Nidhin\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\Nidhin\AppData\Local\Programs\Python\Python37\;C:\Users\Nidhin\AppData\Local\Programs\Fiddler;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs\;C:\Users\Nidhin\AppData\Roaming\npm;C:\Windows\System32;C:\WINDOWS/system32/WindowsPowerShell/v1.0
7921 verbose lifecycle @angular/cli@6.0.8~postinstall: CWD: C:\Users\Nidhin\AppData\Roaming\npm\node_modules\@angular\cli
7922 silly lifecycle @angular/cli@6.0.8~postinstall: Args: [ '/d /s /c', 'node ./bin/ng-update-message.js' ]
7923 info lifecycle @angular/cli@6.0.8~postinstall: Failed to exec postinstall script
7924 silly lifecycle @angular/cli@6.0.8~postinstall: Returned: code: -4058 signal: null
7925 info lifecycle @angular/cli@6.0.8~postinstall: Failed to exec postinstall script
7926 timing action:postinstall Completed in 679ms
7927 verbose unlock done using C:\Users\Nidhin\AppData\Roaming\npm-cache\_locks\staging-2479c5e9a87c27dd.lock for C:\Users\Nidhin\AppData\Roaming\npm\node_modules\.staging
7928 warn rollback Rolling back is-descriptor@1.0.2 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\Nidhin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\define-property\node_modules'
7929 warn rollback Rolling back is-extendable@1.0.1 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\Nidhin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\mixin-deep\node_modules'
7930 warn rollback Rolling back define-property@1.0.0 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\Nidhin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\snapdragon-node\node_modules'
7931 warn rollback Rolling back kind-of@3.2.2 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\Nidhin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\to-object-path\node_modules'
7932 timing stage:rollbackFailedOptional Completed in 3584ms
7933 timing stage:runTopLevelLifecycles Completed in 135690ms
7934 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\@angular\cli\node_modules\fsevents):
7935 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
7936 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
7936 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
7936 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: win32
7936 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
7937 verbose stack Error: @angular/cli@6.0.8 postinstall: `node ./bin/ng-update-message.js`
7937 verbose stack spawn C:\Windows\System32\cmd.exe; ENOENT
7937 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
7937 verbose stack at onErrorNT (internal/child_process.js:406:16)
7937 verbose stack at process._tickCallback (internal/process/next_tick.js:63:19)
7938 verbose pkgid @angular/cli@6.0.8
7939 verbose cwd C:\WINDOWS\system32
7940 verbose Windows_NT 6.1.7601
7941 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli@latest"
7942 verbose node v10.7.0
7943 verbose npm v6.1.0
7944 error file C:\Windows\System32\cmd.exe;
7945 error path C:\Windows\System32\cmd.exe;
7946 error code ELIFECYCLE
7947 error errno ENOENT
7948 error syscall spawn C:\Windows\System32\cmd.exe;
7949 error @angular/cli@6.0.8 postinstall: `node ./bin/ng-update-message.js`
7949 error spawn C:\Windows\System32\cmd.exe; ENOENT
7950 error Failed at the @angular/cli@6.0.8 postinstall script.
7950 error This is probably not a problem with npm. There is likely additional logging output above.
7951 verbose exit [ 1, true ]
答案 0 :(得分:0)
我已经解决了这个问题,问题是从ComSpec路径C:\ Windows \ System32 \ cmd.exe的末尾删除分号(;)
您可以通过以下方式打开它: 我的电脑->属性->高级->环境变量->系统变量
在这里,将此添加到路径上
Image of System variable 注意:我在使用react js时遇到了这个问题。
答案 1 :(得分:0)
转到
My Computer -> properties -> Advance -> Environment Variables -> System Variables
单击ComSpec,然后单击底部的“编辑”按钮
并将“ ComSpec” 的路径设置为等于C:\Windows\System32\cmd.exe
。
答案 2 :(得分:0)
为我修复的是我的解决方案目录与 Windows 位于不同的驱动器上
在我的 C 驱动器上创建我的解决方案为我解决了这个问题