我是npm和nodejs的新手。输出是什么意思?如何调试?
某些版本信息:
10:29:33 + echo ==========================+
10:29:33 ==========================+
10:29:33 + which node
10:29:33 /usr/bin/node
10:29:33 + echo ==========================+
10:29:33 ==========================+
10:29:33 + /usr/local/n/versions/node/5.5.0/bin/node --version
10:29:33 v5.5.0
10:29:33 + echo ==========================+
10:29:33 ==========================+
10:29:33 + node -v
10:29:33 v0.10.37
10:29:33 + echo ==========================+
10:29:33 ==========================+
10:29:33 + /usr/local/n/versions/node/5.5.0/bin/npm --version
10:29:33 3.3.12
10:29:33 + echo ==========================+
10:29:33 ==========================+
...
错误输出:
10:30:42 + /usr/local/n/versions/node/5.5.0/bin/npm run build
10:30:43
10:30:43 > myproject@1.0.0 build /tmp/3791.work
10:30:43 > gulp && webpack
10:30:43
10:30:43
10:30:43 /tmp/3791.work/gulpfile.js:30
10:30:43 gulp.task( 'sass', () => {
10:30:43 ^
10:30:43 SyntaxError: Unexpected token )
10:30:43 at Module._compile (module.js:439:25)
10:30:43 at Object.Module._extensions..js (module.js:474:10)
10:30:43 at Module.load (module.js:356:32)
10:30:43 at Function.Module._load (module.js:312:12)
10:30:43 at Module.require (module.js:364:17)
10:30:43 at require (module.js:380:17)
10:30:43 at Liftoff.handleArguments (/tmp/3791.work/node_modules/gulp/bin/gulp.js:116:3)
10:30:43 at Liftoff.<anonymous> (/tmp/3791.work/node_modules/liftoff/index.js:192:16)
10:30:43 at module.exports (/tmp/3791.work/node_modules/flagged-respawn/index.js:17:3)
10:30:43 at Liftoff.<anonymous> (/tmp/3791.work/node_modules/liftoff/index.js:185:9)
10:30:43
10:30:43 npm ERR! Linux 3.2.0-34-virtual
10:30:43 npm ERR! argv "/usr/local/n/versions/node/5.5.0/bin/node" "/usr/local/n/versions/node/5.5.0/bin/npm" "run" "build"
10:30:43 npm ERR! node v5.5.0
10:30:43 npm ERR! npm v3.3.12
10:30:43 npm ERR! code ELIFECYCLE
10:30:43 npm ERR! myproject@1.0.0 build: `gulp && webpack`
10:30:43 npm ERR! Exit status 8
gulpfile.js的一部分:
30 gulp.task( 'sass', () => {
31 config.sass.targets.forEach( target => {
32 gulp.src( target.src )
33 .pipe( sass( config.sass.options ) )
34 .pipe( gulp.dest( target.dest ) );
35 });
36 });
答案 0 :(得分:0)
箭头功能(它们是es2015的一部分)默认在节点0.10-0.12中禁用,并在5.5中启用
您在节点0.10中出现了与不支持的箭头函数语法相关的错误。
简而言之,当您运行gulp
时,就会运行node gulp
。您表明which node
给出了节点0.10的路径,因此gulp总是在它下面运行。
<强>解决方案强>
/usr/local/n/versions/node/5.5.0/bin/node $(which gulp)