繁体   English   中英

Node.js SurfaceBook Win10:@ angular / cli无法安装

[英]Node.js SurfaceBook Win10 : @angular/cli will not install

技术细节:

  • SurfaceBook / win10最新;
  • Node.js 8.9.4 x64
  • 使用管理员帐户

目标是开发一个应用程序(Web应用程序没什么特别的)并使其在此笔记本电脑上运行。 它可以在我的其他设备(win7和Linux)上正常工作。

我试图用StackOverflow的其他答案解决问题。 我经历了:删除文件(Appdata / roaming / npm和npm-cache); 卸载node.js,重新安装等。 什么都没有。

在cmd.exe提示符下使用NPM(Win版本)时,我收到一条奇怪的消息。 但是在Git抨击下它并没有说太多。

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%的命中率?

海中的瓶子...帮助。

我想我找到了问题的根本原因。

似乎一个在线Microsoft帐户(使用W10和SurfaceBooks时很容易激活)禁止软件修改用户主目录中的某些目录。 此目录(或其一部分)以某种方式与Microsoft服务同步。

因此,您不能像仅是本地的那样“弄乱”它。 使用该服务时,这些目录看起来像受系统保护的目录。 不使用时 它们就像您可能都知道的一样被隐藏了。 同步的是“ AppData”等。

另外,我建议将Docker与NodeJs / Angular一起使用。 特别是因为Angular从版本4开始定期更新。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM