Search code examples
javascriptnode.jsexpressheroku

Yarn Builld - ENOENT: no such file or directory, lstat


Created a nodeJs app for building API's. The app is working locally, but when tried to push it to Heroku got a build error. So tried to Build locally first but got an error.

yarn start build

nps is executing `build` : nps banner.build && nps config && nps lint && nps clean.dist && nps copy && nps copy.tmp && nps clean.tmp
nps is executing `banner.build` : ts-node --transpile-only ./commands/banner.ts build
  _           _ _     _ 
 | |__  _   _(_) | __| |
 | '_ \| | | | | |/ _` |
 | |_) | |_| | | | (_| |
 |_.__/ \__,_|_|_|\__,_|
                        

nps is executing `config` : ts-node --transpile-only ./commands/tsconfig.ts
nps is executing `lint` : tslint -c ./tslint.json ./src/**/*.ts --format stylish
nps is executing `clean.dist` : node node_modules/rimraf/bin.js ./dist
nps is executing `copy` : nps copy.public
nps is executing `copy.public` : copyfiles --up 1 ./src/public/* ./dist
nps is executing `copy.tmp` : ncp ./.tmp/src ./dist
There were errors during the copy.

Error: ENOENT: no such file or directory, lstat

New to javascript, so need a solution to fix it.

Thank you

Tried:

  1. Cleared cache
  2. Deleted Node modules
  3. Upgraded to Latest version

Solution

  • The above error shows that the "tmp/src" folder is missing, This could be because you are missing the transpile step while building the node js app.

    • Please check if you are missing the transpile command within your script.
    • Check the node version you are using locally and in Heroku.
    • Run yarn build locally and see if there is any Error.