我无法“ npm run release”,显示错误号1

时间:2018-11-16 07:17:33

标签: node.js reactjs npm

当我使用npm run release释放项目时,收到错误消息:

> react-scaffold@1.0.0 release 
/home/nick/code/ops_order_system/ops_order/fesrc
> gulp release

assert.js:42
throw new errors.AssertionError({
^

AssertionError [ERR_ASSERTION]: Task function must be specified
    at Gulp.set [as _setTask]                     (/home/nick/code/ops_order_system/ops_order/fesrc/node_modules/undertaker/lib/set-task.js:10:3)
at Gulp.task (/home/nick/code/ops_order_system/ops_order/fesrc/node_modules/undertaker/lib/task.js:13:8)
at Object.<anonymous> (/home/nick/code/ops_order_system/ops_order/fesrc/gulpfile.js:36:6)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-scaffold@1.0.0 release: `gulp release`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the react-scaffold@1.0.0 release 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!     /home/nick/.npm/_logs/2018-11-16T06_59_44_162Z-debug.log

然后,我将文件/home/nick/.npm/_logs/2018-11-16T06_59_44_162Z-debug.log放在目录中:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'release' ]
2 info using npm@6.4.1
3 info using node@v8.12.0
4 verbose run-script [ 'prerelease', 'release', 'postrelease' ]
5 info lifecycle react-scaffold@1.0.0~prerelease: react-scaffold@1.0.0
6 info lifecycle react-scaffold@1.0.0~release: react-scaffold@1.0.0
7 verbose lifecycle react-scaffold@1.0.0~release: unsafe-perm in lifecycle true
8 verbose lifecycle react-scaffold@1.0.0~release: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/nick/code/ops_order_system/ops_order/fesrc/node_modules/.bin:/home/nick/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle react-scaffold@1.0.0~release: CWD: /home/nick/code/ops_order_system/ops_order/fesrc
10 silly lifecycle react-scaffold@1.0.0~release: Args: [ '-c', 'gulp release' ]
11 silly lifecycle react-scaffold@1.0.0~release: Returned: code: 1  signal: null
12 info lifecycle react-scaffold@1.0.0~release: Failed to exec release script
13 verbose stack Error: react-scaffold@1.0.0 release: `gulp release`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:915:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid react-scaffold@1.0.0
15 verbose cwd /home/nick/code/ops_order_system/ops_order/fesrc
16 verbose Linux 4.15.0-36-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "release"
18 verbose node v8.12.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error react-scaffold@1.0.0 release: `gulp release`
22 error Exit status 1
23 error Failed at the react-scaffold@1.0.0 release script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

然后我尝试'gulp release',它也显示错误:

assert.js:42
throw new errors.AssertionError({
^

AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask]     (/home/nick/code/ops_order_system/ops_order/fesrc/node_modules/undertaker/lib/se    t-task.js:10:3)
at Gulp.task     (/home/nick/code/ops_order_system/ops_order/fesrc/node_modules/undertaker/lib/ta    sk.js:13:8)
at Object.<anonymous>     (/home/nick/code/ops_order_system/ops_order/fesrc/gulpfile.js:36:6)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)

版本是

node: v8.12.0
npm: 6.4.1
gulp: CLI version 2.0.1
      Local version 4.0.0

我尝试了多种方法来解决此错误,但是没有人可以解决。我真的很想知道如何解决这个问题!

在我问这个问题之前,我已经尝试过npm cache clear --force rm -rf node_modules npm install,但这对我也不起作用。我还使用root在上面运行这些命令,但这无济于事。

1 个答案:

答案 0 :(得分:0)

我已经知道为什么了。我应该安装gulp -g。 使用npm install -g gulp对我有用。