我有Hostgator云站点。我不知道问题所在。
已安装的节点& npm正确。
节点-v: v8.11.1
npm -v: 5.6.0
当我试图运行此命令时
npm run watch
它给出了这个错误
> @ watch /home2/wgrltz65/wedding.ajdandd.tech
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
sh: cross-env: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @ 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`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @ watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home2/wgrltz65/.npm/_logs/2018-04-18T19_44_08_103Z-debug.log
当我输入日志时,我发现了这个日志:
0 info it worked if it ends with ok
1 verbose cli [ '/home2/wgrltz65/bin/node',
1 verbose cli '/home2/wgrltz65/bin/npm',
1 verbose cli 'run',
1 verbose cli 'watch' ]
2 info using npm@5.6.0
3 info using node@v8.11.1
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: /home2/wgrltz65/nodejs/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home2/wgrltz65/wedding.ajdandd.tech/node_modules/.bin:/usr/local/jdk/bin:/home2/wgrltz65/perl5/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/cpanel/composer/bin:/opt/python27/bin:/usr/local/bin:/usr/X11R6/bin:/home2/wgrltz65/bin
9 verbose lifecycle @~watch: CWD: /home2/wgrltz65/wedding.ajdandd.tech
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 info lifecycle @~watch: Failed to exec watch script
12 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`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/home2/wgrltz65/nodejs/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at emitTwo (events.js:126:13)
12 verbose stack at ChildProcess.emit (events.js:214:7)
12 verbose stack at maybeClose (internal/child_process.js:925:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
13 verbose pkgid @
14 verbose cwd /home2/wgrltz65/wedding.ajdandd.tech
15 verbose Linux 3.10.0-693.17.1.2.ELK.el6.x86_64
16 verbose argv "/home2/wgrltz65/bin/node" "/home2/wgrltz65/bin/npm" "run" "watch"
17 verbose node v8.11.1
18 verbose npm v5.6.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 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`
23 error spawn ENOENT
24 error Failed at the @ watch script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
答案 0 :(得分:2)
看起来hostgator不支持共享基础架构上的节点:http://support.hostgator.com/articles/specialized-help/technical/node-js