question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm install is inconsistent

See original GitHub issue

I’m not able to consistently install clasp. I sometimes get these errors:

sudo npm i -g @google/clasp
/usr/local/bin/clasp -> /usr/local/lib/node_modules/@google/clasp/index.js

> grpc@1.12.2 install /usr/local/lib/node_modules/@google/clasp/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Pre-built binaries not installable for grpc@1.12.2 and node@8.11.2 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@google/clasp/node_modules/grpc/src/node'
gyp WARN EACCES user "root" does not have permission to access the dev dir "/var/root/.node-gyp/8.11.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@google/clasp/node_modules/grpc/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/@google/clasp/node_modules/grpc/.node-gyp/8.11.2"
...

Configs

npm -v
5.6.0
node -v
v8.11.2

Command

sudo npm i -g @google/clasp
/usr/local/bin/clasp -> /usr/local/lib/node_modules/@google/clasp/index.js
+ @google/clasp@1.3.1
updated 1 package in 11.211s
sudo npm uninstall -g @google/clasp

Possible Solutions

This seems to not give the errors: sudo npm i -g @google/clasp --allow-root

Another option would be to remove grpc, but I believe it is needed with a different npm module.

sudo npm i -g @google/clasp --unsafe-perm seems to always work too.

However, running clasp gives this error still:

/usr/local/lib/node_modules/@google/clasp/node_modules/grpc/src/grpc_extension.js:45
    throw error;
    ^

Error: The gRPC binary module was not installed. This may be fixed by running "npm rebuild"
Original error: Cannot find module '/usr/local/lib/node_modules/@google/clasp/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown/grpc_node.node'
    at Object.<anonymous> (/usr/local/lib/node_modules/@google/clasp/node_modules/grpc/src/grpc_extension.js:43:17)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@google/clasp/node_modules/grpc/src/client_interceptors.js:145:12)
    at Module._compile (module.js:652:30)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
grantcommented, May 26, 2018

I think grpc is used for StackDriver logs (@google-cloud/logging):

Error: Cannot find module 'grpc'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@google/clasp/node_modules/@google-cloud/common-grpc/src/service.js:26:12)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

If this is the case, we should remove @google-cloud/logging in favor of googleapis.

1reaction
grantcommented, May 26, 2018

Running sudo npm rebuild in the clasp folder fixes the CLI. Maybe it should be added as a postinstall step.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inconsistent behaviour when installing NPM packages globally
I have a feeling that NPM has some sort of inconsistent behaviour when installing packages. When installing globally, it runs successfully but ...
Read more >
npm behaving very strange and inconsistent on 'npm install'.
Originally filed bug with gifsicle, but it was determined that npm packages were broken. Please refer to: kohler/gifsicle#52 (comment).
Read more >
Docker local NodeJS install NPM modules is inconsistent - Bugs ...
Clicking the “install NPM modules” doesn't solve the problem, but clicking the “Deploy” button solves. The procedure for installing NPM modules needs to...
Read more >
npm-outdated
This command will check the registry to see if any (or, specific) installed packages are currently outdated. By default, only the direct dependencies...
Read more >
@barusu/tool-find-inconsistent NPM | npm.io
Install. npm install -g @barusu/tool-find-inconsistent. yarn yarn global add @barusu/tool-find-inconsistent. Usage. Check if the version number of the same ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found