egg
egg copied to clipboard
AssertionError: /snapshot/Users/zzg/Desktop/eggPro/package.json should exist ⚠️ Command Error, enable `DEBUG=common-bin` for detail
What happens?
./ldimcicd start /snapshot/Users/zzg/Desktop/eggPro --port=3001 --title=test_pkg
⚠️ AssertionError: /snapshot/Users/zzg/Desktop/eggPro/package.json should exist
⚠️ Command Error, enable DEBUG=common-bin
for detail
工程文件
我用pkg打包eggjs工程, 首先用simple-type方式创建工程 工程创建完成之后,就添加了三个文件 controller:archive.js server:progress.js view:index.html
复现步骤,错误日志以及相关配置
- yarn build
- ./ldimcicd start /snapshot/Users/zzg/Desktop/eggPro --port=3001 --title=test_pkg
文图就复现了
config.default.js
/* eslint valid-jsdoc: "off" */
'use strict';
/**
* @param {Egg.EggAppInfo} appInfo app info
*/
module.exports = appInfo => {
/**
* built-in config
* @type {Egg.EggAppConfig}
**/
const config = exports = {};
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1639376947047_7755';
// add your middleware config here
config.middleware = [];
config.security = {
csrf: {
enable: false,
},
};
config.view = {
mapping: {
'.html': 'ejs',
},
};
// config.ejs = {
// delimiter:"{"
// }
// 资源文件前缀重写
// config.static = {
// prefix:"/assets/"
// }
config.static = {
prefix: '/',
dir: process.cwd() + '/public'
}
config.rundir = process.cwd() + '/run'
// add your user config here
const userConfig = {
// myAppName: 'egg',
};
return {
...config,
...userConfig,
};
};
plugin.js
'use strict';
exports.ejs = {
enable: true,
package: 'egg-view-ejs',
};
package.json
{
"name": "ldimcicd",
"version": "1.0.0",
"description": "ldimci-cd",
"private": true,
"egg": {
"declarations": true
},
"dependencies": {
"egg": "^2.15.1",
"egg-scripts": "^2.11.0",
"egg-view-ejs": "^2.0.1",
"element-ui": "^2.15.6"
},
"devDependencies": {
"autod": "^3.0.1",
"autod-egg": "^1.1.0",
"egg-bin": "^4.11.0",
"egg-ci": "^1.11.0",
"egg-mock": "^3.21.0",
"eslint": "^5.13.0",
"eslint-config-egg": "^7.1.0"
},
"engines": {
"node": ">=10.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-LDIMCI",
"stop": "egg-scripts stop --title=egg-server-LDIMCI",
"dev": "egg-bin dev",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov",
"autod": "autod",
"build": "pkg . --targets node14 --out-path ./dist --debug"
},
"ci": {
"version": "10"
},
"repository": {
"type": "git",
"url": ""
},
"pkg": {
"assets": [
"./config/*.js",
"./app.js",
"./app/**/*.js",
"./node_modules/nanoid/**/*.js"
]
},
"author": "zzg",
"license": "MIT",
"bin": "build.js"
}
相关环境信息
- 操作系统:
- 11.4
- Node 版本:
- 14.18.1
- Egg 版本: "egg": "^2.15.1", "egg-scripts": "^2.11.0", "egg-view-ejs": "^2.0.1", "element-ui": "^2.15.6"
pkg 文件打包和映射的问题吧,请自查。
Is there a solution?