Skip to content

Postinstall script installation fails when installing locally #3792

@horike37

Description

@horike37

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions