こんにちは。
現在typescriptでバックエンドの開発を行っているのですが、
webpackでbuild実行しに以下のエラーが出てしまいます。
調べてみても解決に繋がるようなものが見当たらなかったので質問させてください。
よろしくお願いします。。。
ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './cache' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 5:12-30 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './compile' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 3:20-40 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './compile/async' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 28:29-55 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './compile/error_classes' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 34:19-53 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './compile/formats' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 8:14-42 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './compile/resolve' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 4:14-42 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './compile/rules' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 9:12-38 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './compile/schema_obj' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 6:19-50 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './compile/util' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 11:11-36 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './data' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 10:22-39 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts ERROR in ./node_modules/ajv/lib/ajv.js Module not found: Error: Can't resolve './keyword' in '/Users/nakashun1129/****/sam/app/node_modules/ajv/lib' @ ./node_modules/ajv/lib/ajv.js 29:20-40 @ ./src/presentation/dto/request/Request.ts @ ./src/presentation/handler/RestHandler.ts @ ./src/presentation/handler/users/UserRestHandler.ts @ ./src/index.ts npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! ***@1.0.0 build: `webpack` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the spicy@1.0.0 build 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! /Users/nakashun1129/.npm/_logs/2020-08-20T03_12_56_443Z-debug.log make[1]: *** [build] Error 2 make: *** [local-package] Error 2
weboack.config const path = require("path"); module.exports = { mode: "development", entry: path.resolve(__dirname, "src/index.ts"), output: { path: path.resolve(__dirname, "dist/"), filename: "index.js", libraryTarget: "umd" }, externals: { typeorm: 'commonjs typeorm' }, resolve: { extensions: [".ts"], alias: { "@src": path.resolve(__dirname, "src") } }, target: "node", module: { rules: [ { test: /.ts$/, exclude: /node_modules/, use: { loader: "ts-loader", options: { configFile: path.resolve(__dirname, "tsconfig.json") } } } ] } };
package.json { "name": "spicy", "version": "1.0.0", "description": "API with Typescript.", "scripts": { "build": "webpack", "test": "jest --coverage", "db:seed": "ts-node ./seeds/insert.ts", "migration:run": "ts-node ./node_modules/typeorm/cli.js migration:run", "migration:revert": "ts-node ./node_modules/typeorm/cli.js migration:revert", "migration:create": "ts-node ./node_modules/typeorm/cli.js migration:create -n" }, "keywords": [ "node", "typescript", "lambda" ], "license": "MIT", "devDependencies": { "@types/ajv": "^1.0.0", "@types/aws-lambda": "^8.10.46", "@types/jest": "^25.1.4", "@types/node": "^12.12.29", "@types/pg": "^7.14.4", "aws-sdk": "^2.638.0", "jest": "^25.2.4", "ts-jest": "^25.3.0", "ts-loader": "^6.2.2", "ts-node": "^8.7.0", "typescript": "^3.8.3", "webpack": "^4.42.1", "webpack-cli": "^3.3.11" }, "dependencies": { "ajv": "^6.8.1", "axios": "^0.18.1", "pg": "^8.0.0", "reflect-metadata": "^0.1.13", "ts-log-debug": "^5.4.1", "typeorm": "^0.2.18" } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。