简体   繁体   中英

Unsupported platform for fsevents error on installing Angular cli

I encountered the following error in installing 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"})

When I use the ng -v command, it displays a message that does not recognize this command

The program 'ng' is currently not installed. You can install it by typing:
sudo apt install ng-common

OS: Linux mint 18.3

nodejs version 9.3.0

Help me please

and the I used this command:

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

and output is like this:

/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.

I solved this problem like this:

Path known Assuming you have a global modules set up for npm (by default ~/.node_modules_global)

$ npm prefix -g

Now set the path of modules/bin to our bash path environment to access over terminal

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

How about setting a new one!

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

Now the final touch, install angular/cli package

npm install -g @angular/cli

reference: github

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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