Skip to content

Missing source files when building package installed from GitHub #28

@claycarpenter

Description

@claycarpenter

I'm running into an issue where the build script is failing for a package that is installed via git/github. The error message looks like this:

> angular2-token@0.2.0-beta.13 postinstall /Users/clay/dev/code/tmp/postinstall-test/node_modules/angular2-token
> postinstall-build lib --script=build --verbose


> angular2-token@0.2.0-beta.13 prepublish /Users/clay/dev/code/tmp/postinstall-test/node_modules/angular2-token
> npm run build


> angular2-token@0.2.0-beta.13 build /Users/clay/dev/code/tmp/postinstall-test/node_modules/angular2-token
> rimraf lib && ngc -p src

Error: ENOENT: no such file or directory, lstat 'src'
    at Object.fs.lstatSync (fs.js:947:11)
    at Object.main (/Users/clay/dev/code/tmp/postinstall-test/node_modules/angular2-token/node_modules/@angular/tsc-wrapped/src/main.js:59:21)
    at main (/Users/clay/dev/code/tmp/postinstall-test/node_modules/angular2-token/node_modules/@angular/compiler-cli/src/main.js:19:16)
    at Object.<anonymous> (/Users/clay/dev/code/tmp/postinstall-test/node_modules/angular2-token/node_modules/@angular/compiler-cli/src/main.js:35:5)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Function.Module.runMain (module.js:609:10)
Compilation failed

This only fails when I'm trying to install from Git:

npm i --save MadeByMunstersLLC/angular2-token#fix_postinstallIssue

When the installation is from my local repo, it works perfectly fine:

npm i --save /path/to/MadeByMunstersLLC/angular2-token

The postinstall and build scripts for the (forked) angular2-token project are pretty straightforward:

  "scripts": {
    "test": "karma start",
    "build": "rimraf lib && ngc -p src",
    "prepublish": "npm run build",
    "postinstall": "postinstall-build lib --script=build --verbose"
  },

I've tried with a number of different npm versions, and each results in the same error. I forgot to keep track of exactly which versions, but IIRC they included 5.4, 5.3, 4.6, 4.2, and 3.10. I've reverted to node 8.4.0 and npm 5.3.0, where I'm still seeing the problems.

Seems like this issue might be similar (or identical) to #16, but that issue doesn't mention the package source, and as that seems to be playing a significant role in determining where postinstall-build can work with npm to successfully build a package, I figured I'd open up this new issue.

Any thoughts on this build error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions