如何设置next.js?

jim*_*mmy 3 next.js

我只是按照官方网站的步骤:

https://nextjs.org/docs/

第1步。

npm install --save next react react-dom
Run Code Online (Sandbox Code Playgroud)

步骤 2. 向 package.json 添加脚本

{
  "scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start"
  }
}
Run Code Online (Sandbox Code Playgroud)

步骤 3. 在项目中添加 ./pages/index.js:

export default () => <div>Welcome to next.js!</div>
Run Code Online (Sandbox Code Playgroud)

然后我运行 npm run dev 并得到错误:

/Users/jh/Documents/worksapce/react/nextJs/test1/node_modules/webpackbar/dist/index.js:55
    const hasRunning = () => Object.values(sharedState).find(s => s.isRunning);
                                ^

TypeError: Object.values is not a function
Run Code Online (Sandbox Code Playgroud)

我哪里做错了?

小智 5

这是由于您的节点版本。请升级您的节点版本。Node >= 7.0.0 完全支持这一点。