Heroku: Ошибка: не удается найти модуль node-gyp

Вчера (23.03.18) начала получать эту ошибку при развертывании heroku, и понятия не имею, почему. Никаких изменений пакетов или чего-либо, что касается узловых модулей. Эта ошибка возникает на yarn install

Любая помощь будет оценена по достоинству.

    [4/4] Building fresh packages...
    error An unexpected error occurred: "/tmp/build_0ee997c3e293524b58e17ee6d643ada3/blog/node_modules/sharp: Command failed.
    Exit code: 1
    Command: sh
    Arguments: -c node-gyp rebuild
    Directory: /tmp/build_0ee997c3e293524b58e17ee6d643ada3/blog/node_modules/sharp
    Output:
    module.js:545
      throw err;
      ^
    Error: Cannot find module '/tmp/build_0ee997c3e293524b58e17ee6d643ada3/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'
      at Function.Module._resolveFilename (module.js:543:15)
      at Function.Module._load (module.js:470:25)
      at Function.Module.runMain (module.js:690:10)
      at startup (bootstrap_node.js:194:16)
      at bootstrap_node.js:666:3".
         info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_0ee997c3e293524b58e17ee6d643ada3/blog/yarn-error.log".
         info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
    error An unexpected error occurred: "Command failed.
    Exit code: 1
    Command: sh
    Arguments: -c cd blog && yarn install && yarn deploy && cd ..
    Directory: /tmp/build_0ee997c3e293524b58e17ee6d643ada3
    Output:
    ".
         info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_0ee997c3e293524b58e17ee6d643ada3/yarn-error.log".
         info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    error An unexpected error occurred: "Command failed.
    Exit code: 1
    Command: sh

person TheNastyOne    schedule 24.03.2018    source источник


Ответы (1)


Проблема возникла из-за того, что NPM выпустил неработающее обновление. Откатился с 5.8.0 на 5.7.1.

- РЕДАКТИРОВАТЬ - Чтобы заблокировать версию NPM на Heroku, добавьте следующий код в свой package.json файл. "engines": { "npm": "5.7.1" ...other stuff },

person TheNastyOne    schedule 24.03.2018
comment
Это сработало для меня. Для ясности я хотел упомянуть, что это указано в package.json в разделе двигателей. двигатели: {npm: 5.7.1} - person Sean McCleary; 27.03.2018
comment
Сэкономил мне часы! - person Maruccio; 17.05.2021