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

npm start 时无法正常启动 #92

Open
shenzhenjia opened this issue Jan 1, 2015 · 10 comments
Open

npm start 时无法正常启动 #92

shenzhenjia opened this issue Jan 1, 2015 · 10 comments

Comments

@shenzhenjia
Copy link

[email protected] start /Users/edward/workspace/projects/spmjs.io
pm2 start app.js --name spmjs && ./node_modules/.bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash

[PM2] Spawning PM2 daemon
[PM2] Success
[PM2] Process app.js launched
┌──────────┬────┬──────┬─────┬────────┬───────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ PID │ status │ restarted │ uptime │ memory │ watching │
├──────────┼────┼──────┼─────┼────────┼───────────┼────────┼─────────────┼──────────┤
│ spmjs │ 0 │ fork │ 626 │ online │ 0 │ 0s │ 20.512 MB │ disabled │
└──────────┴────┴──────┴─────┴────────┴───────────┴────────┴─────────────┴──────────┘
Use pm2 info <id|name> to get more details about an app
sh: ./node_modules/.bin/pm2: No such file or directory

npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.11.14
npm ERR! npm v2.1.14
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: pm2 start app.js --name spmjs && ./node_modules/.bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the [email protected] start script 'pm2 start app.js --name spmjs && ./node_modules/.bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash'.
npm ERR! This is most likely a problem with the spmjs.io package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! pm2 start app.js --name spmjs && ./node_modules/.bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash
npm ERR! You can get their info via:
npm ERR! npm owner ls spmjs.io
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/edward/workspace/projects/spmjs.io/npm-debug.log

@sorrycc
Copy link
Member

sorrycc commented Jan 1, 2015

npm install 一下。

On Thu, Jan 1, 2015 at 9:14 AM, shenzhenjia [email protected]
wrote:

[email protected] start /Users/edward/workspace/projects/spmjs.io
pm2 start app.js --name spmjs && ./node_modules/.bin/pm2 start
./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash

[PM2] Spawning PM2 daemon
[PM2] Success
[PM2] Process app.js launched

┌──────────┬────┬──────┬─────┬────────┬───────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ PID │ status │ restarted │ uptime │ memory │
watching │

├──────────┼────┼──────┼─────┼────────┼───────────┼────────┼─────────────┼──────────┤
│ spmjs │ 0 │ fork │ 626 │ online │ 0 │ 0s │ 20.512 MB │ disabled │

└──────────┴────┴──────┴─────┴────────┴───────────┴────────┴─────────────┴──────────┘
Use pm2 info <id|name> to get more details about an app
sh: ./node_modules/.bin/pm2: No such file or directory

npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.11.14
npm ERR! npm v2.1.14
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: pm2 start app.js --name spmjs &&
./node_modules/.bin/pm2 start
./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the [email protected] start script 'pm2 start app.js
--name spmjs && ./node_modules/.bin/pm2 start
./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter
bash'.
npm ERR! This is most likely a problem with the spmjs.io package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! pm2 start app.js --name spmjs && ./node_modules/.bin/pm2 start
./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash
npm ERR! You can get their info via:
npm ERR! npm owner ls spmjs.io
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/edward/workspace/projects/spmjs.io/npm-debug.log


Reply to this email directly or view it on GitHub
#92.

@shenzhenjia
Copy link
Author

执行了,没错误, node_modules下也都有那些依赖组件了,但从错误日志的中的提到的
./node_modules/.bin/pm2 , 在本地的文件夹目录中的./bin下是没有PM2的。

edwarddeMacBook-Pro:spmjs.io edward$ npm install
edwarddeMacBook-Pro:spmjs.io edward$
image

@moonye6
Copy link

moonye6 commented Jan 1, 2015

我也碰到这个问题了 运行环境是win7
而且我单独使用npm install pm2,node modules下已经有这个目录,报错也还是和上面一样
安装pm2时没有报错,但有这样一个提示npm WARN optional dep failed, continuing [email protected]

afc163 added a commit that referenced this issue Jan 1, 2015
@afc163
Copy link
Member

afc163 commented Jan 1, 2015

感觉像是 npm install 没有完全成功。

我改了下再试试,不用 .bin 目录下的了,直接用包里面的 bin 文件。

@moonye6
Copy link

moonye6 commented Jan 1, 2015

不确定是什么导致的,上面修改的还是有问题
修改前,start的时候会启两个进程,app.js是启动成功的,但elasticsearch启动失败,用pm2 list看elasticsearch进程是不存在的
修改后,一个都起不来了,提示是路径问题,

[email protected] start D:\study\spmjs.io
./node_modules/pm2/bin/pm2 start app.js --name spmjs && ./node_modules/pm2/bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash

'.' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

npm ERR! [email protected] start: ./node_modules/pm2/bin/pm2 start app.js --name spmjs && ./node_modules/pm2/bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the spmjs.io package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ./node_modules/pm2/bin/pm2 start app.js --name spmjs && ./node_modules/pm2/bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash
npm ERR! You can get their info via:
npm ERR! npm owner ls spmjs.io
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! cwd D:\study\lego\spmjs.io
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\study\lego\spmjs.io\npm-debug.log
npm ERR! not ok code 0

@afc163
Copy link
Member

afc163 commented Jan 1, 2015

这个 npm script 脚本用的是 bash ,不支持 window,你可以拆开来自己运行。

@afc163
Copy link
Member

afc163 commented Jan 1, 2015

window 有 bat 可以跑的。https://github.com/afc163/elasticsearch-package/tree/master/bin

@moonye6
Copy link

moonye6 commented Jan 3, 2015

拆开运行确实是ok的 有空试试你下面的bat脚本 多谢

@shenzhenjia
Copy link
Author

按修改后的脚本运行,还是出错
edwarddeMacBook-Pro:spmjs.io edward$ npm start

[email protected] start /Users/edward/workspace/projects/spmjs.io
./node_modules/pm2/bin/pm2 start app.js --name spmjs && ./node_modules/pm2/bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash

module.js:338
throw err;
^
Error: Cannot find module 'commander'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/Users/edward/workspace/projects/spmjs.io/node_modules/pm2/bin/pm2:5:17)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)

npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.11.14
npm ERR! npm v2.1.14
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: ./node_modules/pm2/bin/pm2 start app.js --name spmjs && ./node_modules/pm2/bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script './node_modules/pm2/bin/pm2 start app.js --name spmjs && ./node_modules/pm2/bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash'.
npm ERR! This is most likely a problem with the spmjs.io package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ./node_modules/pm2/bin/pm2 start app.js --name spmjs && ./node_modules/pm2/bin/pm2 start ./node_modules/elasticsearch-package/bin/elasticsearch -x --interpreter bash
npm ERR! You can get their info via:
npm ERR! npm owner ls spmjs.io
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/edward/workspace/projects/spmjs.io/npm-debug.log
edwarddeMacBook-Pro:spmjs.io edward$

image

@sorrycc
Copy link
Member

sorrycc commented Jan 4, 2015

@shenzhenjia 好像是 pm2 没装好,手动执行下 npm install pm2 试试。

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