简体   繁体   中英

Complete Guide for Installing APM on Windows

Currently, I am studying about ReactJS with Atom Editor and I want to try out ATOM REACT PLUGIN . For the installation, it require me to use the command apm install react but the Windows CMD doesn't recognize apm . After searching on the internet, it seems that calling the apm command is simple on Mac but not simple on Windows. Is there a step by step installation guide for apm in Windows?

Install Shell Commands on Mac: 在此处输入图片说明

In Windows version, I cannot find it out: 在此处输入图片说明

Add it to the system path environment variables.

- `Win + R: then type %localappdata%` 
  • Go to Atom > app-(atom version)> resources > app > apm > bin

    Copy the entire path and open the system path environment settings window. Append to the end and confirm. Restart console(command prompt or gitbash)

    This applies to every command line interface, in case you want to know where the executable is located use the where command.

    - where apm

    - where node

courtesy :- https://github.com/atom/apm/issues/381#issuecomment-126911491

The problem is that the Atom installation did not successfully add the Atom bin folder to the path.

I run into this issue quite a bit, as Windows environment variables are of finite size. On my dev machine, where I typically have many things installed, each install wants to add itself to the path, resulting in a very long PATH variable, which ends up being truncated by the OS, causing lots of headaches. It can actually break things quite badly for you, if the truncation happens at an unfortunate location.

Here's my solution:

You need to edit and clean up both the User PATH env variable, as well as System one.

  • I usually would copy them into a text editor (on Win7: Right-click on Computer->Properties->Advanced system settings->Environment Variables->double-click PATH)
  • then I replace the ';' character with a linebreak char (depending on your editor, it could be something else) for easier editing.
  • Then I proceed to remove duplicates
  • Then I remove long paths with environment variables that I previously defined. For example, there are lots of occurrence of 'C:\\Program Files (X86)'. That's 22 characters for every occurrence. You can define a system environment variable, say 'PgmX86', then replace every occurrence of the longer string with '%PgmX86%'. You will save 14 characters for each occurrence. Similarly, replace occurrences of 'C:\\Users\\AppData\\Local' with %LocalAppData%, which is a predefined variable.
  • I then restore the ';' characters instead of line breaks, and then paste back into the env variable setting dialog.

Once you go thru this kind of cleanup, don't forget to add %LocalAppData%\\atom\\bin to your user path.

That should take care of Atom and apm!

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