claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily
https://claudiajs.com
MIT License
3.8k stars 274 forks source link

Cannot find module error during create #219

Open mythril opened 4 years ago

mythril commented 4 years ago

core-js@2.6.11 postinstall /tmp/5EIwzH/kast-api-1.0.0-R36iJI/package/node_modules/core-js node -e "try{require('./postinstall')}catch(e){}"

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN kast-api@1.0.0 No description npm WARN kast-api@1.0.0 No repository field.

added 306 packages from 197 contributors in 4.537s

2 packages are looking for funding run npm fund for details validating package Error: Cannot find module '/tmp/5EIwzH/kast-api-1.0.0-R36iJI/package/bin/api' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at validatePackage (/home/luke/.config/yarn/global/node_modules/claudia/src/tasks/validate-package.js:16:15) at initEnvVarsFromOptions.then.then.then.then.then.then.then.then.then.dir (/home/luke/.config/yarn/global/node_modules/claudia/src/commands/create.js:360:10) at process._tickCallback (internal/process/next_tick.js:68:7) cannot require ./bin/api after clean installation. Check your dependencies. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


* Link to a minimal, executable project that demonstrates the problem:
I can't, but I can give you package.json:

{ "name": "kast-api", "version": "1.0.0", "license": "UNLICENSED", "dependencies": { "aws-sdk": "^2.761.0", "babel-cli": "^6.26.0", "babel-plugin-inline-dotenv": "^1.6.0", "babel-preset-env": "^1.7.0", "claudia-api-builder": "^4.1.2", "fm.liveswitch": "^1.9.4-33424" }, "babel": { "presets": [ [ "env", { "targets": { "node": "10" } } ] ], "plugins": [ "inline-dotenv" ] }, "scripts": { "build": "babel src --out-dir bin", "create": "yarn run build && claudia create --region us-west-2 --api-module bin/api --policies policies/*.js", "deploy": "yarn run build && claudia update" } }


After the command is ran the referenced directory `/tmp/5EIwzH/kast-api-1.0.0-R36iJI/package/bin/` does not exist, although `/tmp/5EIwzH/kast-api-1.0.0-R36iJI/package/` does and seems to have the un-transpiled code

* Steps to install the project:

* Steps to reproduce the problem:
mythril commented 4 years ago

hmm, this seems to be caused by having bin in .gitignore