npm run build 报错
> frontende@1.0.0 build E:\workspace\automation\frontend > node build/build.js internal/modules/cjs/loader.js:775 throw err; ^ Error: Cannot find module 'chalk' Require stack: - E:\workspace\automation\frontend\build\check-versions.js - E:\workspace\automation\frontend\build\build.js ?[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)?[39m ?[90m at Function.Module._load (internal/modules/cjs/loader.js:677:27)?[39m ?[90m at Module.require (internal/modules/cjs/loader.js:830:19)?[39m ?[90m at require (internal/modules/cjs/helpers.js:68:18)?[39m at Object.<anonymous> (E:\workspace\automation\frontend\build\check-versions.js:2:15) ?[90m at Module._compile (internal/modules/cjs/loader.js:936:30)?[39m ?[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)?[39m ?[90m at Module.load (internal/modules/cjs/loader.js:790:32)?[39m ?[90m at Function.Module._load (internal/modules/cjs/loader.js:703:12)?[39m ?[90m at Module.require (internal/modules/cjs/loader.js:830:19)?[39m { code: ?[32m'MODULE_NOT_FOUND'?[39m, requireStack: [ ?[32m'E:\\workspace\\automation\\frontend\\build\\check-versions.js'?[39m, ?[32m'E:\\workspace\\automation\\frontend\\build\\build.js'?[39m ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! frontende@1.0.0 build: `node build/build.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the frontende@1.0.0 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! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-12-12T10_01_54_169Z-debug.log
解决方法:npm install npm@latest ,把npm更新到最新版本即可
重新执行npm run build,成功打包!!
原博客地址:https://blog.csdn.net/Anne_01/article/details/86596379
一切技术都是为业务服务,脱离业务的技术一文不值!