在Centos 7上安装nest.js

时间:2018-10-21 09:40:23

标签: node.js npm centos7

我正在CentOS 7上安装nest.js。出现此错误:

file:///usr/lib/node_modules/@nestjs/cli/node_modules/@nuxtjs/opencollective/src/index.js:7
  ;(async () => {
          ^

SyntaxError: Unexpected token (
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.2 (node_modules/@nestjs/cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 3.10.0-693.21.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "i" "-g" "@nestjs/cli"
npm ERR! node v6.14.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! @nestjs/cli@5.5.0 postinstall: `opencollective`
npm ERR! Exit status 1

有什么主意吗?

2 个答案:

答案 0 :(得分:1)

答案就在错误消息中:

moveTo

不确定要安装的npm ERR! node v6.14.3 版本,但当前版本具有此要求:

nest.js

请参见"engines": { "node": ">= 8.9.0" }, packages.json官方。

答案 1 :(得分:0)

这在我的centos 7上有效。我使用的命令是

[root@yellowdog ~]# npm install -g @nestjs/cli
/usr/bin/nest -> /usr/lib/node_modules/@nestjs/cli/bin/nest.js

> @nestjs/cli@5.5.0 postinstall /usr/lib/node_modules/@nestjs/cli
> opencollective

                          Thanks for installing nest 
                 Please consider donating to our open collective
                        to help us maintain this package.

                            Number of contributors: 54
                              Number of backers: 97
                            Annual budget: US$ 37,495
                             Current balance: US$ 246

         Become a partner: https://opencollective.com/nest/donate

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/@nestjs/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ @nestjs/cli@5.5.0
added 215 packages from 173 contributors in 20.529s
[root@yellowdog ~]# node -v
v8.11.4
[root@yellowdog ~]# npm -v
6.4.1
[root@yellowdog ~]# nest --version
5.5.0