当前位置:   article > 正文

vue-ssr框架nuxt填坑_dev: `nuxt`

dev: `nuxt`

Nuxt.js 1.0.0 初始化与依赖包安装

  1、vue init nuxt/started
  2、npm install
  3、npm run dev
  • 1
  • 2
  • 3

npm run dev 报错

> nuxt-temp@1.0.0 dev E:\MaYunProject\nuxt-temp
> nuxt

E:\MaYunProject\nuxt-temp\node_modules\nuxt\dist\nuxt.js:79
async function promiseFinally(fn, finalFn) {
      ^^^^^^^^

SyntaxError: Unexpected token function
    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.<anonymous> (E:\MaYunProject\nuxt-temp\node_modules\nuxt\index.js:17:20)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "G:\\node\\node.exe" "G:\\node\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! nuxt-temp@1.0.0 dev: `nuxt`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nuxt-temp@1.0.0 dev script 'nuxt'.
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 nuxt-temp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nuxt
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs nuxt-temp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls nuxt-temp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     E:\MaYunProject\nuxt-temp\npm-debug.log
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41

解决错误

node 升级到 node8.12.0

升级到nuxt-edge Nuxt.js 2.0

1、运行 npm run dev报错

     ERROR  Failed to compile with 1 errors
     Module build failed (from ./node_modules/eslint-loader/index.js):
     TypeError: Cannot read property 'eslint' of undefined
         at Object.module.exports (.../node_modules/eslint-loader/index.js:148:18)

     You may use special comments to disable some warnings.
     Use // eslint-disable-next-line to ignore the next line.
     Use /* eslint-disable */ to ignore all warnings in a file.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

2、修正错误:编辑nuxt.conf.js文件并将其更改为

      - module.exports = {
      + export default {
          // ...
          build: {
              /*
              ** Run ESLint on save
              */
          -    extend (config, { isDev, isClient }) {
          -      if (isDev && isClient) {
          +    extend (config, { isDev }) {
          +      if (isDev && process.client) {
                  config.module.rules.push({
                  enforce: 'pre',
                  test: /\.(js|vue)$/,
                  loader: 'eslint-loader',
                  exclude: /(node_modules)/
                  })
              }
              }
          }
      }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

3、 重启服务,打开浏览器并访问:http://localhost:3000/。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/971268
推荐阅读
相关标签
  

闽ICP备14008679号