安装Angular cli时,fsevents错误的平台不受支持

时间:2018-01-05 15:56:00

标签: node.js angular

我在安装Angular时遇到以下错误。

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3  (node_modules/@angular/cli/node_modules/fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

当我使用 ng -v 命令时,它会显示一条无法识别此命令的消息

The program 'ng' is currently not installed. You can install it by typing:
sudo apt install ng-common
操作系统:Linux薄荷18.3

nodejs版本9.3.0

请帮帮我

2 个答案:

答案 0 :(得分:1)

我使用了这个命令:

npm install --no-optional -g @angular/cli

和输出是这样的:

/home/user/.npm-global/bin/ng -> /home/user/.npm-global/lib/node_modules/@angular/cli/bin/ng
npm WARN sass-loader@6.0.6 requires a peer of node-sass@^4.0.0 but none is installed. You must install peer dependencies yourself.

答案 1 :(得分:0)

我解决了这个问题:

路径已知 假设你有一个为npm设置的全局模块(默认为〜/ .node_modules_global)

$ npm prefix -g

现在将modules / bin的路径设置为我们的bash路径环境以通过终端访问

$ echo -e "export PATH=$(npm prefix -g)/bin:$PATH" >> ~/.bashrc 
$ source ~/.bashrc

如何设置一个新的!

$ mkdir ~/path/module
$ npm config set prefix '~/path/module'
$ sudo chown -R $USER <directory>

现在最后一步,安装angular / cli包

npm install -g @angular/cli

参考:github