尝试在共享主机-component上使用Vue应用程序部署laravel 5.5不会更新

时间:2018-09-04 18:57:12

标签: laravel laravel-5 vuejs2 shared-hosting

我正在尝试在共享主机上部署Laravel应用程序。我也在使用Vuejs。几乎一切正常。唯一的问题是更改后未更新的组件。我正在执行以下步骤:

  1. 将Laravel项目(文件)从本地主机复制到共享主机。项目正在运作(vue除外)
  2. 在根目录(不在laravel文件夹中)中安装nodejs。我使用以下命令:

    2.1 wget -qO- https://cdn.rawgit.com/creationix/nvm/master/install.sh |重击

    2.2导出NVM_DIR =“ $ HOME / .nvm”

    2.3 [-s“ $ NVM_DIR / nvm.sh”] &&。 “ $ NVM_DIR / nvm.sh”

    2.4 [-s“ $ NVM_DIR / bash_completion”] &&。 “ $ NVM_DIR / bash_completion”

    2.5 nvm安装节点

    2.6 nvm使用节点

  3. 接下来,我要转到laravel文件夹并输入npm run watch,但出现错误。以下是npm的日志内容

    0 info it worked if it ends with ok
    1 verbose cli [ '/home/mojstrona/.nvm/versions/node/v10.10.0/bin/node',
    1 verbose cli   '/home/mojstrona/.nvm/versions/node/v10.10.0/bin/npm',
    1 verbose cli   'run',
    1 verbose cli   'watch' ]
    2 info using npm@6.4.1
    3 info using node@v10.10.0
    4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
    5 info lifecycle @~prewatch: @
    6 info lifecycle @~watch: @
    7 verbose lifecycle @~watch: unsafe-perm in lifecycle true
    8 verbose lifecycle @~watch: PATH: /home/mojstrona/.nvm/versions/node/v10.10.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/mojstrona/domains/moj.stronazen.pl/l55/node_modules/.bin:/home/mojstrona/.nvm/versions/node/v10.10.0/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/puppetlabs/bin:/home/mojstrona/.local/bin:/home/mojstrona/bin
    9 verbose lifecycle @~watch: CWD: /home/mojstrona/domains/moj.stronazen.pl/l55
    10 silly lifecycle @~watch: Args: [ '-c',
    10 silly lifecycle   'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
    11 silly lifecycle @~watch: Returned: code: 126  signal: null
    12 info lifecycle @~watch: Failed to exec watch script
    13 verbose stack Error: @ watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
    13 verbose stack Exit status 126
    13 verbose stack     at EventEmitter.<anonymous> (/home/mojstrona/.nvm/versions/node/v10.10.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
    13 verbose stack     at EventEmitter.emit (events.js:182:13)
    13 verbose stack     at ChildProcess.<anonymous> (/home/mojstrona/.nvm/versions/node/v10.10.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
    13 verbose stack     at ChildProcess.emit (events.js:182:13)
    13 verbose stack     at maybeClose (internal/child_process.js:962:16)
    13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
    14 verbose pkgid @
    15 verbose cwd /home/mojstrona/domains/moj.stronazen.pl/l55
    16 verbose Linux 3.10.0-714.10.2.lve1.5.17.el7.x86_64
    17 verbose argv "/home/mojstrona/.nvm/versions/node/v10.10.0/bin/node" "/home/mojstrona/.nvm/versions/node/v10.10.0/bin/npm" "run" "watch"
    18 verbose node v10.10.0
    19 verbose npm  v6.4.1
    20 error code ELIFECYCLE
    21 error errno 126
    22 error @ watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
    22 error Exit status 126
    23 error Failed at the @ watch script.
    23 error This is probably not a problem with npm. There is likely additional logging output above.
    24 verbose exit [ 126, true ]
    

我可以使用chmod -R a + x node_modules解决此错误,但是出现下一个错误

error  in ./resources/assets/sass/app.scss
Module build failed: Error: Missing binding /home/mojstrona/domains/moj.stronazen.pl/l55/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x** Run `npm rebuild node-sass` to download the binding for your current environment.

因此,我正在重新启动SSH并运行npm rebuild node-sass而没有错误。然后我也正在运行npm run watch并出现任何错误,但是问题仍然存在。即使更改组件名称,更改后的组件也不会更新。例如:

在更改app.js之前

Vue.component('ex', require('./components/ExampleComponent.vue'));

在更改组件文件夹之前

ExampleComponent.vue

已显示

ExampleComponent.vue

更改app.js后

Vue.component('ex', require('./components/ExampleComponent2.vue'));

更改组件文件夹后

ExampleComponent2.vue

更改后显示

ExampleComponent.vue

app.js中的change2之后

Vue.component('ex', require('./components/ExampleComponent2.vue'));

组件文件夹中的change2之后

ExampleComponent3.vue

更改后显示2

ExampleComponent.vue

下面是npm运行命令结果的屏幕截图。

enter image description here

0 个答案:

没有答案