Error: Cannot find module 'socket.io' when I am making git push
Error: Cannot find module 'socket.io' when I am making git push
我一直在尝试使用以下行将项目上传到 dokku 服务器。
git push dokku master
所以项目开始上传时出现这个错误:
-----> 运行 飞行前检查
For more efficient zero downtime deployments, create a file CHECKS.
See http://progrium.viewdocs.io/dokku/checks-examples.md for examples
CHECKS file not found in container: Running simple container check...
-----> 等待 10 秒 ...
远程:应用容器启动失败!!
=====> 聊天容器输出:
> @ start /app
> node ./doc/node_servers/cobrowsing/server.js
module.js:339
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/socket.io'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/app/doc/node_servers/cobrowsing/server.js:4:10)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:457:10)
npm ERR! Linux 3.13.0-57-generic
npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! code ELIFECYCLE
npm ERR! @ start: `node ./doc/node_servers/cobrowsing/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script 'node ./doc/node_servers/cobrowsing/server.js'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./doc/node_servers/cobrowsing/server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /app/npm-debug.log
=====>结束聊天容器输出
远程:来自守护程序的错误响应:无法终止容器
244766ea68169dfaabcad927484efa546a5c9e7ba100845183a7595120c7668f:容器
244766ea68169dfaabcad927484efa546a5c9e7ba100845183a7595120c7668f 不是 运行
远程:错误:无法杀死容器:
[244766ea68169dfaabcad927484efa546a5c9e7ba100845183a7595120c7668f]
到 dokku@website.com:聊天
! [远程拒绝] master -> master (pre-receive hook declined)
我该怎么做才能解决这个问题并上传项目?
检查您的 package.json 文件。
使用
npm install socket.io --save
在项目文件夹中保存对package.json的依赖。 :)
@EDIT
作者:'I resolve it, I have to delete the folder "node_modules", and then npm install'
我一直在尝试使用以下行将项目上传到 dokku 服务器。
git push dokku master
所以项目开始上传时出现这个错误:
-----> 运行 飞行前检查
For more efficient zero downtime deployments, create a file CHECKS.
See http://progrium.viewdocs.io/dokku/checks-examples.md for examples
CHECKS file not found in container: Running simple container check...
-----> 等待 10 秒 ...
远程:应用容器启动失败!!
=====> 聊天容器输出:
> @ start /app
> node ./doc/node_servers/cobrowsing/server.js
module.js:339
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/socket.io'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/app/doc/node_servers/cobrowsing/server.js:4:10)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:457:10)
npm ERR! Linux 3.13.0-57-generic
npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! code ELIFECYCLE
npm ERR! @ start: `node ./doc/node_servers/cobrowsing/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script 'node ./doc/node_servers/cobrowsing/server.js'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./doc/node_servers/cobrowsing/server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /app/npm-debug.log
=====>结束聊天容器输出
远程:来自守护程序的错误响应:无法终止容器
244766ea68169dfaabcad927484efa546a5c9e7ba100845183a7595120c7668f:容器
244766ea68169dfaabcad927484efa546a5c9e7ba100845183a7595120c7668f 不是 运行
远程:错误:无法杀死容器:
[244766ea68169dfaabcad927484efa546a5c9e7ba100845183a7595120c7668f]
到 dokku@website.com:聊天
! [远程拒绝] master -> master (pre-receive hook declined)
我该怎么做才能解决这个问题并上传项目?
检查您的 package.json 文件。
使用
npm install socket.io --save
在项目文件夹中保存对package.json的依赖。 :)
@EDIT
作者:'I resolve it, I have to delete the folder "node_modules", and then npm install'