方案一:
安装chalk模块
npm install chalk
或者,删掉node_modules,重新运行
npm install
方案二:
看报错信息
Error: Cannot find module 'chalk'
Require stack:
- /Users/gyq/.orionos-cli/dist/tools/logOutput.js
- /Users/gyq/.orionos-cli/dist/index.js
- /usr/local/lib/node_modules/orionos-cli/dist/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1014:15)
at Function.Module._load (internal/modules/cjs/loader.js:884:27)
at Module.require (internal/modules/cjs/loader.js:1074:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/gyq/.orionos-cli/dist/tools/logOutput.js:8:72)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
at Module.require (internal/modules/cjs/loader.js:1074:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/gyq/.orionos-cli/dist/tools/logOutput.js',
'/Users/gyq/.orionos-cli/dist/index.js',
'/usr/local/lib/node_modules/orionos-cli/dist/index.js'
]
}
发现和 Orionos-cli 脚手架相关,重新安装 Orionos-cli 脚手架,解决问题