How add commands to cygwin - npm

前端 未结 4 722
滥情空心
滥情空心 2020-12-16 16:53

I use cygwin on windows 8.1 to have an Unix shell. But I cannot run commands such as npm from it.

What should I do to do it? Add some kind of env var to cygwin? Why

相关标签:
4条回答
  • 2020-12-16 17:40

    In order to fix the npm script to work even with dos encoding, i submitted a patch.

    0 讨论(0)
  • 2020-12-16 17:47

    How to make cygwin work with npm command

    1. install http://nodejs.org/#download
    2. download http://nodejs.org/dist/npm/
    3. extract npm.zip into node.exe
    4. run cygwin terminal again

    That is it!

    0 讨论(0)
  • 2020-12-16 17:49

    This seems to be a problem with the npm script as mentioned here, https://github.com/joyent/node/issues/5912

    Assuming you have installed nodejs in the default location you can run the following dos2unix command and fix the error.

    dos2unix c:/Program\ Files/nodejs/npm

    This fixed my problems with the npm script.

    0 讨论(0)
  • 2020-12-16 17:54
    sed -i 's/\r//' "$(type -p npm)"
    

    Convert line endings

    Also despite the comment, this will not hurt execution with cmd.exe

    $ printf '@echo hello\n@echo world\n@echo doge\n' > foo.bat
    
    $ cmd /c foo.bat
    hello
    world
    doge
    
    0 讨论(0)
提交回复
热议问题