exogen / postinstall-build Goto Github PK
View Code? Open in Web Editor NEWHelper for conditionally building your npm package on postinstall
License: MIT License
Helper for conditionally building your npm package on postinstall
License: MIT License
Hi, I understand that postinstall runs when installing module A in module B. However, it is also running when I do npm install
in module A while development. Is there a way to only execute when it is being installed elsewhere? Thanks!
Everything works correctly on my local machine but on Netlify im getting this error on the postinstall-build
hook:
npm ERR! May not delete: /opt/build/repo/node_modules/react-polymorph/node_modules/.bin
11:37:56 AM: npm ERR! A complete log of this run can be found in:
11:37:56 AM: npm ERR! /opt/buildhome/.npm/_logs/2018-03-22T10_37_56_856Z-debug.log
11:37:56 AM: postinstall-build:
11:37:56 AM: Error: Command failed: sh -c "/opt/buildhome/.nvm/versions/node/v8.2.1/bin/node" "/opt/buildhome/.nvm/versions/node/v8.2.1/lib/node_modules/npm/bin/npm-cli.js" prune --production
11:38:51 AM: npm
Any ideas how to solve this issue?
I tried clone my project and then run npm install, the postinstall build runs fine, also my production script runs fine alone. Except when I adding it to my another project to use as an library.
Here is my package.json
{
...
"main": "dist/bundle.js",
"files": [
"dist/"
],
"scripts": {
"start": "webpack-dev-server",
"clean": "rimraf dist",
"production": "cross-env npm run clean && webpack --config webpack.production.config.js --progress --profile --colors",
"test": "jest",
"postinstall": "postinstall-build dist --script production",
"dependencies": {
"cross-env": "5.1.4",
"lodash": "^4.17.5",
"postinstall-build": "^5.0.1",
"prop-types": "^15.6.1",
"react": "16.3.2",
"react-dom": "16.3.2",
"react-hot-loader": "4.1.0",
"react-router-dom": "4.2.2"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"babel-eslint": "8.2.3",
"babel-jest": "22.4.1",
"babel-loader": "7.1.4",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "6.24.1",
"babel-preset-react": "6.24.1",
"babel-preset-react-boilerplate": "1.1.1",
"babel-preset-react-hmre": "1.1.1",
"babel-preset-stage-3": "^6.24.1",
"copy-webpack-plugin": "4.5.1",
"css-hot-loader": "1.3.9",
"css-loader": "0.28.11",
"enzyme": "3.3.0",
"enzyme-adapter-react-16": "1.1.1",
"eslint": "4.19.0",
"eslint-config-airbnb": "16.1.0",
"eslint-loader": "2.0.0",
"eslint-plugin-import": "2.11.0",
"eslint-plugin-jsx-a11y": "6.0.3",
"eslint-plugin-react": "7.6.0",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.10",
"html-webpack-plugin": "3.2.0",
"husky": "0.15.0-rc.2",
"jest": "22.1.0",
"node-sass": "4.8.3",
"open-browser-webpack-plugin": "0.0.5",
"react-addons-test-utils": "15.6.2",
"react-test-renderer": "16.3.2",
"rimraf": "2.6.2",
"sass-loader": "6.0.7",
"style-loader": "0.20.3",
"url-loader": "1.0.0",
"webpack": "3.11.0",
"webpack-dev-server": "2.9.6"
}
},
I have a package with this package.json
:
{
"name": "@perevezentsev/decode-video",
"version": "3.0.0",
"description": "Decodes video using ffmpeg into raw RGBA32 frames",
"main": "./built/index.js",
"scripts": {
"build": "tsc || true",
"build:watch": "tsc --watch",
"test": "tape ./built/**/*.test.js | tap-spec",
"start": "node ./example/",
"postinstall": "postinstall-build ./built"
},
"author": "Ivan Perevezentsev <[email protected]>",
"license": "UNLICENSED",
"private": true,
"dependencies": {
"@types/node": "^8.0.28",
"chunking-streams": "0.0.8",
"fluent-ffmpeg": "^2.1.2",
"mkdirp": "^0.5.1",
"png-async": "^0.9.2",
"postinstall-build": "^5.0.1",
"rimraf": "^2.6.1"
},
"devDependencies": {
"eslint": "^4.2.0",
"eslint-config-airbnb-base": "^11.2.0",
"eslint-plugin-import": "^2.7.0",
"tap-spec": "^4.1.1",
"tape": "^4.8.0",
"typescript": "^2.5.2"
}
}
When running npm install
in a project using this package, postinstall-build
is triggered correctly, but npm build
script doesn't see TypeScript compiler which is in the devDependencies
:
➜ test npm i -S ../video-decoder2
> @perevezentsev/[email protected] postinstall /home/vanya/Documents/prog/1.videonow/test/node_modules/@perevezentsev/decode-video
> postinstall-build ./built
postinstall-build:
This version of npm (5.4.1) may not be compatible with postinstall-build! There
are outstanding bugs in certain versions of npm that prevent it from working with
postinstall-build. See https://github.com/exogen/postinstall-build#bugs-in-npm
for more information.
> @perevezentsev/[email protected] build /home/vanya/Documents/prog/1.videonow/video-decoder2
> tsc || true
sh: 1: tsc: not found
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN @perevezentsev/[email protected] No description
npm WARN @perevezentsev/[email protected] No repository field.
+ @perevezentsev/[email protected]
added 24 packages in 9.097s
➜ test npm -v
5.4.1
Are there plans to fix this for this version of npm?
I have "postinstall-build": "^5.0.0",
in the dependencies
array. I'm using [email protected]
. I tried this with yarn instead of npm and was getting more errors. I have [email protected]
and [email protected]
.
➜ twistly-api git:(master) ✗ npm install --production
> [email protected] install /Users/xo/code/twistly-api/node_modules/dtrace-provider
> node scripts/install.js
> [email protected] postinstall /Users/xo/code/twistly-api
> postinstall-build dist
postinstall-build:
This version of npm (5.0.3) may not be compatible with postinstall-build! There
are outstanding bugs in certain versions of npm that prevent it from working with
postinstall-build. See https://github.com/exogen/postinstall-build#bugs-in-npm
for more information.
> [email protected] install /Users/xo/code/twistly-api/node_modules/fsevents
> node install
[fsevents] Success: "/Users/xo/code/twistly-api/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
> [email protected] postinstall /Users/xo/code/twistly-api
> postinstall-build dist
sh: postinstall-build: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] postinstall: `postinstall-build dist`
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xo/.npm/_logs/2017-07-05T05_09_46_247Z-debug.log
postinstall-build:
Error: Command failed: sh -c "/usr/local/Cellar/node/8.1.3/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" install --only=dev
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `postinstall-build dist`
npm ERR! Exit status 1
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xo/.npm/_logs/2017-07-05T05_09_46_552Z-debug.log
Excerpt from my package.json
.
{
"name": "twistly",
"version": "1.0.0",
"description": "Twistly",
"private": true,
"scripts": {
"clean-dist": "rm -rf dist && mkdir dist",
"build": "npm run clean-dist && babel ./src -d ./dist -s",
"lint": "xo",
"test": "nyc ava test/**/*.spec.js",
"postinstall": "postinstall-build dist",
"start": "node MODE=worker ./dist/index.js"
},
"dependencies": {
"agenda": "^0.9.1",
"async": "^1.5.2",
"bcryptjs": "^2.4.3",
"body-parser": "^1.15.0",
"bunyan": "^1.8.10",
"configstore": "^3.1.0",
"cross-env": "^4.0.0",
"dumb-passwords": "^0.2.1",
"express": "^4.13.4",
"express-api-error-handler": "^1.1.0",
"express-healthcheck": "^0.1.0",
"express-jwt": "^5.1.0",
"express-session": "^1.15.3",
"hat": "^0.0.3",
"http-errors": "^1.6.1",
"joi": "^10.5.0",
"jsonwebtoken": "^7.3.0",
"loud-rejection": "^1.6.0",
"meow": "^3.7.0",
"method-override": "^2.3.3",
"mongoose": "^4.4.6",
"numeral": "^2.0.6",
"passport": "^0.3.2",
"passport-tumblr": "^0.1.2",
"postinstall-build": "^5.0.0",
"tumblr.js": "0.0.7"
},
"devDependencies": {
"ava": "^0.19.1",
"babel-cli": "^6.24.0",
"babel-core": "^6.24.0",
"babel-plugin-stack-trace-sourcemap": "^1.0.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-stage-2": "^6.22.0",
"babel-watch": "^2.0.6",
"coveralls": "^2.13.0",
"nyc": "^10.2.0",
"snyk": "1.16.0",
"supertest": "^3.0.0",
"xo": "^0.18.2"
},
"buildDependencies": {
"babel-cli": "^6.24.0",
"babel-core": "^6.24.0",
"babel-plugin-stack-trace-sourcemap": "^1.0.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-stage-2": "^6.22.0"
}
}
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
I tried to run this with babel and some other dependencies but seems like it failed :(...
./scripts/postinstall simply do console.log(process.cwd())
devDependencies:
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.2",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-runtime": "^6.23.0",
"chokidar-cli": "^1.2.0",
"cross-env": "^4.0.0",
"eslint": "^3.19.0",
"eslint-config-semistandard": "^8.0.0",
"eslint-config-standard": "^10.2.0",
"eslint-plugin-import": "~2.2.0",
"eslint-plugin-node": "~4.2.2",
"eslint-plugin-promise": "~3.5.0",
"eslint-plugin-standard": "~3.0.1",
"husky": "^0.13.3",
"istanbul": "^0.4.5",
"lint-staged": "^3.4.0",
"mocha": "^3.2.0",
"npm-run-all": "^4.0.2",
"nsp": "^2.6.3",
"testdouble": "^2.1.2"
Node and npm version:
Now using node v6.5.0 (npm v3.10.3)
Error Log:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
path.js:1144
cwd = process.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at Error (native)
at Object.resolve (path.js:1144:25)
at startup (bootstrap_node.js:127:32)
at bootstrap_node.js:509:3
{ Error: Command failed: sh -c node ./scripts/postinstall
at ChildProcess.<anonymous> (/usr/local/opt/nvm/versions/node/v6.5.0/lib/node_modules/@cet/create-cet-widget/node_modules/postinstall-build/index.js:53:13)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
killed: false,
code: 1,
signal: null,
cmd: 'sh -c node ./scripts/postinstall' }
Branch | Build failing 🚨 |
---|---|
Dependency | doctoc |
Current Version | 1.3.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
doctoc is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 5 commits.
30d6569
1.3.1
1d38626
doc: adding patreon badge
14ec48c
Update .travis.yml (#136)
e0831d3
Add pre-commit metadata to doctoc
9113184
Update comment
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Not sure if it helps. Here's the log:
1601 verbose stack Error: May not delete: /Users/user/Workspace/organization/core/test/node_modules/@cool/node_modules/.bin
1601 verbose stack at gentlyRm (/Users/user/.nvm/versions/node/v8.1.4/lib/node_modules/npm/lib/utils/gently-rm.js:49:15)
1601 verbose stack at gentlyRmBinRoot (/Users/user/.nvm/versions/node/v8.1.4/lib/node_modules/npm/lib/unbuild.js:86:12)
1601 verbose stack at cb (/Users/user/.nvm/versions/node/v8.1.4/lib/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
1601 verbose stack at next (/Users/user/.nvm/versions/node/v8.1.4/lib/node_modules/npm/node_modules/fs-vacuum/vacuum.js:66:14)
1601 verbose stack at /Users/user/.nvm/versions/node/v8.1.4/lib/node_modules/npm/node_modules/fs-vacuum/vacuum.js:54:9
1601 verbose stack at FSReqWrap.oncomplete (fs.js:135:15)
1602 verbose cwd /Users/user/Workspace/organization/core/test/node_modules/@cool
1603 verbose Darwin 16.7.0
1604 verbose argv "/Users/user/.nvm/versions/node/v8.1.4/bin/node" "/Users/jerrythebest/.nvm/versions/node/v8.1.4/bin/npm" "prune" "--production"
1605 verbose node v8.1.4
1606 verbose npm v5.3.0
1607 error May not delete: /Users/user/Workspace/organization/core/test/node_modules/@cool/node_modules/.bin
1608 verbose exit [ 1, true ]
Btw, it works great with [email protected] ([email protected])!
Seems it doesn't work with builds done by webpack. Works fine until I'll request npm run build for the App. npm start:dev
doesn't throw though app is not bootstrapping
App packages.js
{
"name": "experiments-editor",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "./node_modules/mocha/bin/mocha --compilers js:babel-core/register --require ./test/test_helper.js 'test/**/*.@(js|jsx)'",
"test:watch": "npm run test -- --watch",
"build": "webpack --optimize-minimize --optimize-occurrence-order --optimize-dedupe --production",
"start:dev": "node ./src/server.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.7.6",
"babel-loader": "^6.2.4",
"chai": "^3.4.0",
"chai-immutable": "^1.4.0",
"jsdom": "^9.9.1",
"mocha": "^3.2.0",
"react-hot-loader": "^3.0.0-alpha.8",
"redux-devtools": "^3.2.0",
"redux-devtools-dock-monitor": "^1.1.1",
"redux-devtools-log-monitor": "^1.0.11",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.1"
},
"dependencies": {
"babel-polyfill": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-es2015-loose": "^8.0.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"classnames": "^2.2.0",
"css-loader": "^0.26.1",
"immutable": "^3.7.5",
"lodash": "^4.12.0",
"randomcolor": "^0.5.0",
"react": "^15.4",
"react-addons-pure-render-mixin": "^15.4",
"react-addons-update": "^15.5.2",
"react-dimensions": "^1.1.1",
"react-dom": "^15.4",
"react-jsonschema-form": "https://github.com/b1r3k/react-jsonschema-form/tarball/anyof-prototype",
"react-redux": "^5.0.2",
"react-router": "^3.0.1",
"react-toastr": "^2.8.2",
"redux": "^3.5.1",
"redux-logger": "^2.6.1",
"redux-saga": "^0.14.3",
"style-loader": "^0.13.1"
}
}
lib package.js
{
"name": "react-jsonschema-form",
"version": "0.41.1",
"description": "A simple React component capable of building HTML forms out of a JSON schema.",
"scripts": {
"build:readme": "toctoc README.md -w",
"build:lib": "rimraf lib && cross-env NODE_ENV=production babel -d lib/ src/",
"build:dist": "rimraf dist && cross-env NODE_ENV=production webpack --config webpack.config.dist.js --optimize-minimize",
"build:playground": "rimraf build && cross-env NODE_ENV=production webpack --config webpack.config.prod.js --optimize-minimize && cp playground/index.prod.html build/index.html",
"dist": "npm run build:lib && npm run build:dist",
"lint": "eslint src test",
"publish-to-gh-pages": "npm run build:playground && gh-pages --dist build/",
"publish-to-npm": "npm run build:readme && npm run dist && npm publish",
"start": "node devServer.js",
"tdd": "cross-env NODE_ENV=test mocha --compilers js:babel-register --watch --require ./test/setup-jsdom.js test/**/*_test.js",
"test": " cross-env NODE_ENV=test mocha --compilers js:babel-register --require ./test/setup-jsdom.js test/**/*_test.js",
"postinstall": "postinstall-build --only-as-dependency lib --script build:lib"
},
"main": "lib/index.js",
"files": [
"dist",
"lib"
],
"engineStrict": false,
"engines": {
"npm": "^2.14.7",
"node": ">=6"
},
"peerDependencies": {
"react": "^15.0.0"
},
"dependencies": {
"jsonschema": "^1.0.2",
"lodash.topath": "^4.5.2",
"postinstall-build": "^3.0.1",
"setimmediate": "^1.0.5"
},
"devDependencies": {
"atob": "^2.0.3",
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.7",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-transform-class-properties": "^6.18.0",
"babel-plugin-transform-object-rest-spread": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-register": "^6.18.0",
"chai": "^3.3.0",
"codemirror": "^5.20.2",
"cross-env": "^2.0.1",
"css-loader": "^0.23.1",
"eslint": "^2.13.1",
"eslint-plugin-react": "^4.2.3",
"estraverse": "^4.2.0",
"estraverse-fb": "^1.3.1",
"express": "^4.14.0",
"extract-text-webpack-plugin": "^1.0.1",
"gh-pages": "^0.11.0",
"html": "0.0.10",
"jsdom": "^8.3.0",
"mocha": "^2.5.3",
"postinstall-build": "^3.0.1",
"react": "^15.0.0",
"react-addons-test-utils": "^15.3.2",
"react-codemirror": "^0.2.3",
"react-dom": "^15.3.2",
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.1",
"redbox-react": "^1.3.3",
"rimraf": "^2.6.1",
"sinon": "^1.17.6",
"style-loader": "^0.13.1",
"toctoc": "^0.2.3",
"webpack": "^1.13.3",
"webpack-dev-middleware": "^1.8.4",
"webpack-hot-middleware": "^2.13.2"
},
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mozilla-services/react-jsonschema-form.git"
},
"author": "Nicolas Perriault <[email protected]>",
"keywords": [
"react",
"form",
"json-schema"
],
"license": "Apache-2.0",
"homepage": "https://github.com/mozilla-services/react-jsonschema-form#readme"
}
Ouput from npm run build
for the App
$ npm run build
> [email protected] build /home/lukasz/workspace/commercial/keepsafe/switchboard-editor
> webpack --optimize-minimize --optimize-occurrence-order --optimize-dedupe --production
Warning: ToastMessage.animation: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.
Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
resolve failed for "caniuse-db": Error: Cannot find module 'caniuse-db'
resolve failed for "babel-runtime": Error: Cannot find module 'babel-runtime'
resolve failed for "webpack-core": Error: Cannot find module 'webpack-core'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
sh: 0: Illegal option --
{ Error: Command failed: sh -c --optimize-occurrence-order
at ChildProcess.<anonymous> (/home/lukasz/workspace/commercial/keepsafe/switchboard-editor/node_modules/postinstall-build/index.js:53:13)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
killed: false,
code: 2,
signal: null,
cmd: 'sh -c --optimize-occurrence-order' }
Hash: 8754c3d3585cf5e4ee1f
Version: webpack 1.15.0
Time: 13308ms
Asset Size Chunks Chunk Names
bundle.js 569 kB 0 [emitted] main
bundle.js.map 248 bytes 0 [emitted] main
[0] multi main 40 bytes {0} [built]
+ 844 hidden modules
....
npm ERR! Linux 4.9.0-2-amd64
npm ERR! argv "/home/lukasz/.nvm/versions/node/v6.10.0/bin/node" "/home/lukasz/.nvm/versions/node/v6.10.0/bin/npm" "run" "build"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `webpack --optimize-minimize --optimize-occurrence-order --optimize-dedupe --production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script 'webpack --optimize-minimize --optimize-occurrence-order --optimize-dedupe --production'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the experiments-editor package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack --optimize-minimize --optimize-occurrence-order --optimize-dedupe --production
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs experiments-editor
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls experiments-editor
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/lukasz/workspace/commercial/keepsafe/switchboard-editor/npm-debug.log
I've encountered an issue where a library I've made that relies on Webpack and the Babel "react" preset, and relies on postinstall-build to build in dependent projects, fails when built there. Here's a trimmed down version that reproduces the issue:
https://github.com/bdefore/postinstall-build-error-dependent
https://github.com/bdefore/postinstall-build-error-library
The library project can successfully run npm run build:react
but when it does so in the postinstall step of the dependent project, it fails to parse JSX.
Here's a gist of the terminal output of the failure: https://gist.github.com/bdefore/cb4269649b7e3e4e42dcf1f52d573f9a
The full npm-debug.log is checked in here: https://raw.githubusercontent.com/bdefore/postinstall-build-error-dependent/master/npm-debug.log
my package.json has the following scripts:
"scripts": {
"clean": "rm -rf build",
"cleanall": "rm -rf build && rm -rf node_modules",
"compile": "babel lib --out-dir build",
"install": "postinstall-build build 'npm run compile'"
},
When I call npm install, windows cannot find npm, I added it to PATH environment.
When I call "C:\Windows\system32\cmd.exe /d /s /c npm" it works fine.
Errors:
''npm' is not recognized as an internal or external command,
operable program or batch file.
{ Error: Command failed: C:\Windows\system32\cmd.exe /d /s /c 'npm
at ChildProcess.<anonymous> (C:\Jobs\***\workspace\node_modules\postinstall-build\index.js:47:13)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /d /s /c \'npm' }
WORKAROUND:
use double qoutes
"install": "postinstall-build build \"npm run compile\""
When installing my private npm package (that uses postinstall-build) from the file system, the install fails on some machines with this error:
{ [Error: stderr maxBuffer exceeded] cmd: 'npm install --only=dev' }
I'm assuming this isn't necessarily an issue with postinstall-build directly, but maybe it needs an additional parameter that can set the maxBuffer in the underlying script call or maybe that parameter can just be added to the the script in package.json
The command run by postinstall-build is
babel --presets es2015,stage-0 --plugins add-module-exports -d lib/ src/
The target project had a LOT of dependencies, so we tried deleting the node_models folder to see if that was related, still no luck.
This is only happening on SOME machines. I don't have the problem on my MacBook Pro, but my colleague does on his MacBook Pro :s
Branch | Build failing 🚨 |
---|---|
Dependency | rimraf |
Current Version | 2.6.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As rimraf is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
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:
> [email protected] postinstall /Users/clay/dev/code/tmp/postinstall-test/node_modules/angular2-token
> postinstall-build lib --script=build --verbose
> [email protected] prepublish /Users/clay/dev/code/tmp/postinstall-test/node_modules/angular2-token
> npm run build
> [email protected] 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?
I'm working on a library and the following problem has been arised. Here is an example of my package.json
chunk.
"devDependencies": {
"es5-shim": "^4.5.2",
"inkiik-docstrap": "^1.1.1",
"jscs": "^2.9.0",
"jsdoc": "^3.4.0",
"jshint": "^2.9.1",
"karma": "^0.13.19",
"karma-mocha": "^0.2.1",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sinon-chai": "^1.1.0",
"mocha": "^2.4.5",
"phantomjs-prebuilt": "^2.1.3",
"webpack": "^1.12.12"
},
The problem is that for my library to build it only requires webpack to be installed. But unfortunately all other libraries are installed as well and the installation time lasts way longer than it should be. Maybe devDependencies is not the right place to look for the build dependecies in some cases. I suggest we could utilize some other section where only build dependecies would be explicitly declared. Here is an example.
devDependencies: {
"mocha": "^2.4.5",
"webpack": "^1.12.12"
},
buildDependencies: ['webpack', 'babel']
So if build
field is present in package.json
- install only what's listed there.
npm prune --production
should be optional, because dev dependencies can be needed by automated testing systems, etc.
I've been using Termux a lot lately. I ran npm ping I got this :
npm ping
undefined
npm ERR! Linux 3.10.84-perf-gffac582
npm ERR! argv "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/bin/npm" "ping"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! error:0906D06C:PEM routines:PEM_read_bio:no start line
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! /data/data/com.termux/
I haven't been able to see what I can do in this
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.