Nathan Wailes
Nathan Wailes

Reputation: 12252

Heroku: Error: Cannot find module '/tmp/build_.../.yarn\releases\yarn-1.22.4.js'

I'm trying to use this Flask+Vue.js template, which is meant to be used with Heroku. I got it working, but I'm now trying to add Vuetify, and I'm seeing the error below when I try to push my code:

console output

(resolutewl) C:\Users\Nathan\Documents\resolutewl>git push heroku
Enumerating objects: 102, done.
Counting objects: 100% (102/102), done.
Delta compression using up to 4 threads
Compressing objects: 100% (71/71), done.
Writing objects: 100% (78/78), 1.29 MiB | 629.00 KiB/s, done.
Total 78 (delta 34), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        YARN_PRODUCTION=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=false
remote:        NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  12.16.x
remote:        engines.npm (package.json):   unspecified (use default)
remote:        engines.yarn (package.json):  1.22.4
remote:
remote:        Resolving node version 12.16.x...
remote:        Downloading and installing node 12.16.3...
remote:        Using default npm version: 6.14.4
remote:        Resolving yarn version 1.22.4...
remote:        Downloading and installing yarn (1.22.4)...
remote: internal/modules/cjs/loader.js:960
remote:   throw err;
remote:   ^
remote:
remote: Error: Cannot find module '/tmp/build_88865a3fc4f26d1803aa9da629126610/.yarn\releases\yarn-1.22.4.js'
remote:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:840:27)
remote:     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
remote:     at internal/main/run_main_module.js:18:47 {
remote:   code: 'MODULE_NOT_FOUND',
remote:   requireStack: []
remote: }
remote:        Installed yarn
remote: internal/modules/cjs/loader.js:960
remote:   throw err;
remote:   ^
remote:
remote: Error: Cannot find module '/tmp/build_88865a3fc4f26d1803aa9da629126610/.yarn\releases\yarn-1.22.4.js'
remote:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:840:27)
remote:     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
remote:     at internal/main/run_main_module.js:18:47 {
remote:   code: 'MODULE_NOT_FOUND',
remote:   requireStack: []
remote: }
remote: internal/modules/cjs/loader.js:960
remote:   throw err;
remote:   ^
remote:
remote: Error: Cannot find module '/tmp/build_88865a3fc4f26d1803aa9da629126610/.yarn\releases\yarn-1.22.4.js'
remote:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:840:27)
remote:     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
remote:     at internal/main/run_main_module.js:18:47 {
remote:   code: 'MODULE_NOT_FOUND',
remote:   requireStack: []
remote: }
remote:
remote: -----> Restoring cache
remote:        Caching has been disabled because NODE_MODULES_CACHE=false
remote:
remote: -----> Installing dependencies
remote:        Installing node modules (yarn.lock)
remote:        internal/modules/cjs/loader.js:960
remote:          throw err;
remote:          ^
remote:
remote:        Error: Cannot find module '/tmp/build_88865a3fc4f26d1803aa9da629126610/.yarn\releases\yarn-1.22.4.js'
remote:            at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
remote:            at Function.Module._load (internal/modules/cjs/loader.js:840:27)
remote:            at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
remote:            at internal/main/run_main_module.js:18:47 {
remote:          code: 'MODULE_NOT_FOUND',
remote:          requireStack: []
remote:        }
remote:
remote: -----> Build failed
remote:
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote:        Some possible problems:
remote:
remote:        - A module may be missing from 'dependencies' in package.json
remote:          https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to resolutewl.
remote:
To https://git.heroku.com/resolutewl.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/resolutewl.git'

package.json

{
  "name": "vue_app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve --open",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "postinstall": "yarn build"
  },
  "dependencies": {
    "@vue/cli-service-global": "^4.4.1",
    "axios": "^0.19.2",
    "sass": "^1.26.8",
    "sass-loader": "8.0.2",
    "vue": "^2.6.11",
    "vue-router": "^3.3.2",
    "vuetify": "^2.2.33",
    "vuex": "^3.4.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^4.4.1",
    "@vue/cli-plugin-eslint": "^4.4.1",
    "@vue/cli-service": "^4.4.1",
    "@vue/eslint-config-standard": "^5.1.2",
    "eslint": "^7.2.0",
    "eslint-plugin-import": "^2.21.1",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.1",
    "eslint-plugin-vue": "^6.2.2",
    "lint-staged": "^10.2.9",
    "vue-cli-plugin-vuetify": "~2.0.5",
    "vue-template-compiler": "^2.6.11",
    "vuetify-loader": "^1.4.4"
  },
  "babel": {
    "presets": [
      "@vue/app"
    ]
  },
  "eslintConfig": {
    "root": true,
    "extends": [
      "plugin:vue/essential",
      "@vue/standard"
    ]
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ],
  "engines": {
    "node": "12.16.x",
    "yarn": "1.22.4"
  },
  "gitHooks": {
    "pre-commit": "lint-staged"
  },
  "lint-staged": {
    "*.js": [
      "vue-cli-service lint",
      "git add"
    ],
    "*.vue": [
      "vue-cli-service lint",
      "git add"
    ]
  }
}

What I've tried

Upvotes: 2

Views: 884

Answers (1)

AFOC
AFOC

Reputation: 844

If you have a .yarnrc file, delete it and try again.

I came across this when I changed yarn versions locally to a 1.x version. That automatically generated a .yarnrc file, which I then mistakenly committed to the repo.

The correct file for yarn config is .yarnrc.yml (ref).

Upvotes: 1

Related Questions