美文网首页
今天把koa项目通过git部署到阿里云,错误小结

今天把koa项目通过git部署到阿里云,错误小结

作者: 一个被程序员耽误的厨师 | 来源:发表于2019-04-17 15:44 被阅读0次

1、关于node、npm版本的错误问题


app.use(async (ctx, next) => {

              ^

SyntaxError: Unexpected token (

    at createScript (vm.js:56:10)

    at Object.runInThisContext (vm.js:97:10)

    at Module._compile (module.js:542:28)

    at Object.Module._extensions..js (module.js:579:10)

    at Module.load (module.js:487:32)

    at tryModuleLoad (module.js:446:12)

    at Function.Module._load (module.js:438:3)

    at Module.require (module.js:497:17)

    at require (internal/module.js:20:19)

    at Object. (/usr/local/src/maqiu_blog/bin/www:7:11)

npm ERR! Linux 3.10.0-693.2.2.el7.x86_64

npm ERR! argv "/app/nodejs/bin/node" "/usr/local/bin/npm" "start"

npm ERR! node v6.10.3

npm ERR! npm  v3.10.10

npm ERR! code ELIFECYCLE

npm ERR! server@0.1.0 start: `node bin/www`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the server@0.1.0 start script 'node bin/www'.

npm ERR! Make sure you have the latest version of node.js and npm installed.

npm ERR! If you do, this is most likely a problem with the server package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR!    node bin/www

npm ERR! You can get information on how to open an issue for this project with:

npm ERR!    npm bugs server

npm ERR! Or if that isn't available, you can get their info via:

npm ERR!    npm owner ls server

npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

npm ERR!    /usr/local/src/maqiu_blog/npm-debug.log

解决方法也很简单,首先更新npm


npm update -g

安装n管理包,用来管理node版本


cnpm install -g n

接下来更新node 至最新版本


n latest

小插叙,在更新node时候,爆出了这样的错误-bash: n: 未找到命令,解决方法如下:

ln -s /app/nodejs/bin/n /usr/local/bin

相关文章

网友评论

      本文标题:今天把koa项目通过git部署到阿里云,错误小结

      本文链接:https://www.haomeiwen.com/subject/ewsnwqtx.html