Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

sharing artifacts across stages in codebuild breaks npm commands #74

Open
s1mrankaur opened this issue Oct 14, 2021 · 0 comments
Open

Comments

@s1mrankaur
Copy link

npm scripts like

`test: 'react-scripts test'

`works just fine if the build stage of the code pipeline.

If I use artifact from build stage as an input for deploy stage and run

npm run test It fails in the deploy stage with the following error:
`

CI=true react-scripts test --env=jsdom --no-cache internal/modules/cjs/loader.js:818 throw err; ^ Error: Cannot find module '../scripts/test' Require stack: - /codebuild/output/src177948730/src/node_modules/.bin/react-scripts at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15) at Function.resolve (internal/modules/cjs/helpers.js:80:19) at Object. (/codebuild/output/src177948730/src/node_modules/.bin/react-scripts:31:23) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [ '/codebuild/output/src177948730/src/node_modules/.bin/react-scripts' ]
`
If I change the script to

"test": " ./node_modules/react-scripts/bin/react-scripts.js test ", This works okay in the deploy stage but not in the build stage. What is happening? How can I fix it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant