问题描述
在 Visual Studio Code 上的 IBM Blockchain Platform 上打包智能合约时,我无法找出问题所在。我安装了以下内容:
Node.js v14.16.0 npm 6.14.11 Docker 版本 19.03.13,构建 cd8016b6bc docker-compose 版本 1.25.5,构建未知
我成功创建了一个新的智能合约项目。当我 ram 命令时 - 在命令面板中打包打开的项目。 我收到此错误消息:
> Executing task in folder demoContract: npm run build <
> demoContract@0.0.1 build /home/shubham14/Desktop/Major project - blockchain/demoContract
> tsc
sh: 1: tsc: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! demoContract@0.0.1 build: `tsc`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the demoContract@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists,but node_modules missing,did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /home/shubham14/.npm/_logs/2021-03-03T11_38_29_505Z-debug.log
The terminal process "/bin/bash '-c','npm run build'" terminated with exit code: 1.
Terminal will be reused by tasks,press any key to close it.
**Debug-log :**
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node','/usr/local/bin/npm','run','build' ]
2 info using npm@6.14.11
3 info using node@v14.16.0
4 verbose run-script [ 'prebuild','build','postbuild' ]
5 info lifecycle demoContract@0.0.1~prebuild: demoContract@0.0.1
6 info lifecycle demoContract@0.0.1~build: demoContract@0.0.1
7 verbose lifecycle demoContract@0.0.1~build: unsafe-perm in lifecycle true
8 verbose lifecycle demoContract@0.0.1~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/shubham14/Desktop/Major project - blockchain/demoContract/node_modules/.bin:/home/shubham14/Desktop/jdk-14/bin:/home/shubham14/anaconda3/lib/graphviz:/home/apache-maven-3.6.3/bin:/home/shubham14/anaconda3/bin:/home/shubham14/anaconda3/condabin:/home/shubham14/jdk-14_linux-x64_bin/jdk-14/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle demoContract@0.0.1~build: CWD: /home/shubham14/Desktop/Major project - blockchain/demoContract
10 silly lifecycle demoContract@0.0.1~build: Args: [ '-c','tsc' ]
11 info lifecycle demoContract@0.0.1~build: Failed to exec build script
12 verbose stack Error: demoContract@0.0.1 build: `tsc`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:315:20)
12 verbose stack at maybeClose (internal/child_process.js:1048:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
13 verbose pkgid demoContract@0.0.1
14 verbose cwd /home/shubham14/Desktop/Major project - blockchain/demoContract
15 verbose Linux 5.4.0-42-generic
16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
17 verbose node v14.16.0
18 verbose npm v6.14.11
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error demoContract@0.0.1 build: `tsc`
23 error spawn ENOENT
24 error Failed at the demoContract@0.0.1 build script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1,true ]
解决方法
先尝试运行 npm install
(甚至可能之后重新加载 VS Code)。