Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac 下node启动不了 #5

Open
mcgtts opened this issue Aug 28, 2019 · 4 comments
Open

mac 下node启动不了 #5

mcgtts opened this issue Aug 28, 2019 · 4 comments

Comments

@mcgtts
Copy link

mcgtts commented Aug 28, 2019

image

@qq547057827
Copy link

这个问题解决不了吗?

@zenonux
Copy link

zenonux commented Apr 18, 2020

遇到同样的问题,不知道是不是和本地已经安装node有关

@u5de6
Copy link

u5de6 commented Sep 4, 2020

这个只是部署了环境 具体的某个项目你执行cnpm npm命令就行 相当于起一个node的容器环境 你正常执行你的cnpm install 或者 run等操作就行的 只是要注意bash那里改一下 -p 端口 不然宿主机是访问不了的

@u5de6
Copy link

u5de6 commented Sep 4, 2020

原谅我的shell写法,哈哈
指定 -p 参数后,会暴露出容器的端口给宿主机,一般情况不带的时候,做一些包的安装之类的即可
用法:cnpm -p 8070:8070 run dev
结果:
image

用法:cnpm run dev
结果:
image

下面是我改的命令

# cnpm
cnpm () {
    if [ $1 = "-p" ]; then
        tty=
        tty -s && tty=--tty
        docker run \
            $tty \
            --interactive \
            -p $2 \
            --rm \
            --volume $PWD:/www:rw \
            --workdir /www \
            dnmp_node cnpm "${@:3}"
    else
        tty=
        tty -s && tty=--tty
        docker run \
            $tty \
            --interactive \
            --rm \
            --volume $PWD:/www:rw \
            --workdir /www \
            dnmp_node cnpm "$@"
    fi
}
# golang
go () {
    if [ $1 = "-p" ]; then
        tty=
        tty -s && tty=--tty
        docker run \
            $tty \
            --interactive \
            -p $2 \
            --rm \
            --volume $PWD:/go:rw \
            --workdir /go \
            dnmp_go go "${@:3}"
    else
        tty=
        tty -s && tty=--tty
        docker run \
            $tty \
            --interactive \
            --rm \
            --volume $PWD:/go:rw \
            --workdir /go \
            dnmp_go go "$@"
    fi
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants