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.

Postinstall script installation fails when installing locally

See original GitHub issue

This is a Bug Report

Description

I know a correct way to install globally using npm install serverless - g, but when installing locally in own project with npm install serverless --save, an error occurs during execution of postinstall.js.

Is this bug? or does it mean sls has not supported for installing locally?

step to reproduce

  • Create directory with mkdir sls-project && cd sls-project
  • Run npm init
  • Run npm install serverless --save, and you will see the following error
$npm install serverless --save
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha1-F2n0tVHu3OQZ8FBd6uLiZ2NULTc= integrity checksum failed when using sha1: wanted sha1-F2n0tVHu3OQZ8FBd6uLiZ2NULTc= but got sha512-0TZ20a+xcIl4u0+Mj5xDH2yOWdmQiXlKf9Hm+TgDXjTMsEYb+gDrmb8e8UNAzMCitX8NBqG4Z/FUQIyzv/R1JQ==. (2982 bytes)

> serverless@1.15.3 postinstall /Users/horike/src/sls-project/node_modules/serverless
> node ./scripts/postinstall.js

module.js:471
    throw err;
    ^

Error: Cannot find module '/Users/horike/src/sls-project/node_modules/serverless/node_modules/tabtab/src/cli.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
module.js:471
    throw err;
    ^

Error: Cannot find module '/Users/horike/src/sls-project/node_modules/serverless/node_modules/tabtab/src/cli.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

> spawn-sync@1.0.15 postinstall /Users/horike/src/sls-project/node_modules/spawn-sync
> node postinstall

npm WARN saveError ENOENT: no such file or directory, open '/Users/horike/src/sls-project/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/horike/src/sls-project/package.json'
npm WARN sls-project No description
npm WARN sls-project No repository field.
npm WARN sls-project No README data
npm WARN sls-project No license field.

+ serverless@1.15.3
added 210 packages in 23.298s

Similar or dependent issues:

Additional Data

  • node version: 6.10.2
  • npm version: 5.0.3
  • Serverless Framework Version you’re using:1.15.3
  • Operating System: macOS 10.11.6
  • Stack Trace: above
  • Provider Error messages: above

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
shawnmcleancommented, Jul 2, 2017

npm install -g serverless/serverless should work for now for anyone else looking.

4reactions
HyperBraincommented, Jun 14, 2017

as a quick fix you can use npm install --legacy-bundling in your project dir. This will make sure that npm disables the optimization and flattening. But remove the node_modules dir before.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm install ->Failed at the node-sass@4.5.0 postinstall script
Solved this by force installing node-sass locally: npm install -f node-sass. I was pretty sure ...
Read more >
PostInstall script not running on MacOS - Apple Developer
I have created a package installer for MacOS with "productbuild" command line and adding the postinstall script in the package through command.
Read more >
npm/yarn/pnpm fail to do a local install : r/NixOS - Reddit
npm/yarn/pnpm fail to do a local install. I'm working on a javascript project for work and I can't install the dependencies.
Read more >
pkg: POST-INSTALL script failed | The FreeBSD Forums
Hi, guys! I try to install with pkg some apps and all of them fails with this message: /bin/sh: indexinfo: not found pkg:...
Read more >
Error when installing sonarlint for atom - Google Groups
0.1.2 postinstall C:\Users\JOHNAT~1\AppData\Local\Temp\apm-install-dir-11804-1556-zfgmay.vbol5zh0k9\node_modules\sonarlint\node_modules\atom-languageclient.
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