Protobuf.js: npm install failed

Created on 26 Jul 2017  路  7Comments  路  Source: protobufjs/protobuf.js

protobuf.js version: 6.8.0

> [email protected] postinstall /opt/www/xxx/node_modules/protobufjs
> node scripts/postinstall

module.js:472
    throw err;
    ^

Error: Cannot find module '/opt/www/xxx/node_modules/protobufjs/scripts/postinstall'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)
    at bootstrap_node.js:542:3

Most helpful comment

npm install --unsafe-perm worked.

All 7 comments

I'm getting a very similar error on an ARM6 system.

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] postinstall: `node scripts/postinstall`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

EDIT: Fixed this by making sure node was installed in a default PATH location. Not sure why that worked, but after copying the node files into /usr/local/ everything worked fine.

npm install --unsafe-perm worked.

Still the same problem with the latest version (6.8.8).
My NodeJs is installed under /opt/node/

> [email protected] postinstall /root/my-project/node_modules/protobufjs
> node scripts/postinstall

internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module '/root/my-project/node_modules/protobufjs/scripts/postinstall'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/postinstall`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.

Also having the same issue on 6.8.8, after installing as a global module via npm or yarn:

$ npm install -g protobufjs

When attempting to run:

$ pbjs -t json googleapis//google/ads/googleads/v3/enums/*.proto googleapis//google/ads/googleads/v3/errors/*.proto googleapis//google/ads/googleads/v3/common/*.proto > ./scripts/compiled-enums.json
installing semver@^5.5.0
child_process.js:660
    throw err;
    ^

Error: Command failed: npm --silent install semver@^5.5.0
    at checkExecSyncError (child_process.js:621:11)
    at Object.execSync (child_process.js:657:15)
    at modInstall (/usr/lib/node_modules/protobufjs/cli/util.js:129:19)
    at Object.exports.setup (/usr/lib/node_modules/protobufjs/cli/util.js:140:9)
    at Object.<anonymous> (/usr/lib/node_modules/protobufjs/cli/pbjs.js:7:6)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19) {
  status: 243,
  signal: null,
  output: [ null, null, null ],
  pid: 7911,
  stdout: null,
  stderr: null
}

Versions:
protobufjs: ^6.8.8
node: 12.14.1
npm: 6.13.4

This is happening to me too:

Versions:
OS: Windows 10
protobufjs: 6.10.2
node: 14.15.1
yarn: 1.22.5

This will be fixed by #1234 and in v7.0 when the CLI tools will go to a separate package with their own dependencies.

Same issue here. Any updates on #1234?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kostyay picture kostyay  路  3Comments

jarvanxing picture jarvanxing  路  4Comments

terranmoccasin picture terranmoccasin  路  5Comments

asafcombo picture asafcombo  路  4Comments

b1naryMan picture b1naryMan  路  4Comments