【发布时间】:2018-02-10 00:00:41
【问题描述】:
技术细节:
- SurfaceBook/win10 已更新;
- Node.js 8.9.4 x64
- 使用管理员帐户
我们的目标是制作一个应用程序(网络应用程序没有什么特别之处)并让它在这台笔记本电脑上运行。它在我的其他设备(win7 和 Linux)上运行良好。
我试图用 StackOverflow 的其他答案来解决这个问题。我经历了:删除文件(Appdata/roaming/npm & npm-cache);卸载node.js,重新安装等。没有任何效果。
在 cmd.exe 提示符下使用 NPM(win 版本)时,我收到一条奇怪的消息。但是在 Git bash 下就没什么好说的了。
C:\Users\TexMex>npm -v
'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
5.6.0
C:\Users\TexMex>
Git Bash 更加安静。这并不意味着它没有遇到同样的问题。根据其他 StackOverflow 答案正确设置了“PATH”环境变量S。仍然......它有效......好吧,只要它有效,这不是问题。
安装包时一切顺利,直到@Angular/cli。我每次都会遇到这个“uglify postinstall”错误。
[...]
34735 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
34736 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
34736 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
34736 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: win32
34736 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
34737 warn optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.7.2 (node_modules\@angular\cli\node_modules\node-sass):
34738 warn optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.7.2 install: `node scripts/install.js`
34738 warn optional SKIPPING OPTIONAL DEPENDENCY: spawn C:\WINDOWS\system32\cmd.exe; ENOENT
34739 verbose optional SKIPPING OPTIONAL DEPENDENCY:
34739 verbose optional Failed at the node-sass@4.7.2 install script.
34739 verbose optional SKIPPING OPTIONAL DEPENDENCY: This is probably not a problem with npm. There is likely additional logging output above.
34740 verbose stack Error: uglifyjs-webpack-plugin@0.4.6 postinstall: `node lib/post_install.js`
34740 verbose stack spawn C:\WINDOWS\system32\cmd.exe; ENOENT
34740 verbose stack at _errnoException (util.js:1022:11)
34740 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
34740 verbose stack at onErrorNT (internal/child_process.js:372:16)
34740 verbose stack at _combinedTickCallback (internal/process/next_tick.js:138:11)
34740 verbose stack at process._tickCallback (internal/process/next_tick.js:180:9)
34741 verbose pkgid uglifyjs-webpack-plugin@0.4.6
34742 verbose cwd C:\Users\TexMex\Desktop\DEV\git
34743 verbose Windows_NT 10.0.16299
34744 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "--save-dev" "@angular/cli@latest"
34745 verbose node v8.9.4
34746 verbose npm v5.6.0
34747 error file C:\WINDOWS\system32\cmd.exe;
34748 error path C:\WINDOWS\system32\cmd.exe;
34749 error code ELIFECYCLE
34750 error errno ENOENT
34751 error syscall spawn C:\WINDOWS\system32\cmd.exe;
34752 error uglifyjs-webpack-plugin@0.4.6 postinstall: `node lib/post_install.js`
34752 error spawn C:\WINDOWS\system32\cmd.exe; ENOENT
34753 error Failed at the uglifyjs-webpack-plugin@0.4.6 postinstall script.
34753 error This is probably not a problem with npm. There is likely additional logging output above.
34754 verbose exit [ 1, true ]
问题是它阻止了 @angular/cli 目录的创建和相应的文件在此处“登陆”(全局安装与否)。结果,“ng”命令不可用(这很尴尬)。
我做了功课,尝试了我能找到的所有 StackOverflow 答案;我没有想法。
也许是 Windows 注册表中的一些突发事件(以前安装了一些 nodeJS)?但是如果有的话要从注册表中删除什么键???在这种情况下清理注册表是否相关?它是特定于表面书的吗???这一切都会很奇怪。
所以最后一个问题是: 如何让它发挥作用,100% 确定成功?
海里的瓶子...帮助。
【问题讨论】:
-
将@angular/cli 文件从本地应用程序目录复制到用户/应用程序数据目录使用户能够运行“ng serve”。这是一个不能解决问题的旁路。仍然......它允许应用程序运行。
标签: node.js windows angular-cli