hung-phan / koa-react-isomorphic

Boilerplate for Koa & React
MIT License
127 stars 16 forks source link

npm install throws error in windows 7 system #42

Closed PriyaBhatt13 closed 7 years ago

PriyaBhatt13 commented 7 years ago

I have attached debug-log. npm-debug.txt

hung-phan commented 7 years ago

ah @PriyaBhatt13, I don't think I will support Windows build. The best solution is that you replace every bash script with better-npm-run with add the corresponding envs. You can clone the repo, and try. https://github.com/benoror/better-npm-run. The error causes by setting the env and running bash script

hung-phan commented 7 years ago

Do you have docker support? You can run docker-compose up instead. @PriyaBhatt13

PriyaBhatt13 commented 7 years ago

npm-debug.txt I have docker support and i tried to run docker-compose up . That is throwing error with gulp. Attaching error log. Can u check that @hung-phan

hung-phan commented 7 years ago

ah @PriyaBhatt13, what is the version of the koa-react-isomorphic in your local?

hung-phan commented 7 years ago

The error is fixed with 2.14.2

hung-phan commented 7 years ago

Fix by this commit https://github.com/hung-phan/koa-react-isomorphic/commit/ea0c13bab9ece2b92e40fadfcbed855f452ff829

PriyaBhatt13 commented 7 years ago

I am using 2.14.2 in my local

hung-phan commented 7 years ago

can you run docker-image build? What is the output?

PriyaBhatt13 commented 7 years ago

I tried running docker-image build but it said docker-image is not a command.

I tried docker images

docker-image build

docker images $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE

4c3d1cd997f6 46 minutes ago 1.041 GB bbc491acf789 About an hour ago 1.042 GB node 6.7.0 9873603dc506 2 weeks ago 653.9 MB hello-world latest c54a2cc56cbb 3 months ago 1.848 kB
hung-phan commented 7 years ago

ah sorry, typo. @PriyaBhatt13 it should bedocker-compose build

PriyaBhatt13 commented 7 years ago

Following is output.

$ docker-compose build Building webapp Step 1 : FROM node:6.7.0 ---> 9873603dc506 Step 2 : MAINTAINER Hung Phan ---> Using cache ---> 3aefa3a09770 Step 3 : RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/ releases/download/v1.2.0/dumb-init_1.2.0_amd64 ---> Using cache ---> 2de146076bd5 Step 4 : RUN chmod +x /usr/local/bin/dumb-init ---> Using cache ---> 057cfa690b31 Step 5 : ENV NODE_ENV production SECRET_KEY secret ---> Using cache ---> 3703bb4bd0f4 Step 6 : WORKDIR /opt/app ---> Using cache ---> 1cd39670d211 Step 7 : COPY package.json . ---> Using cache ---> 5fef64a3de2f Step 8 : RUN npm i ---> Using cache ---> bfdaaf8a493b Step 9 : COPY . . ---> 1284d94f182f Removing intermediate container 87d20443eb23 Step 10 : RUN npm run build ---> Running in beb3e4ad17db ←[91mnpm←[0m←[91m info←[0m←[91m it worked if it ends with←[0m←[91m ok npm←[0m←[91m info←[0m←[91m using←[0m←[91m npm@3.10.3 npm←[0m←[91m info←[0m←[91m using←[0m←[91m node@v6.7.0 ←[0m←[91mnpm←[0m←[91m info←[0m←[91m lifecycle←[0m←[91m koa-react-isomorphic@2.14 .2~prebuild: koa-react-isomorphic@2.14.2 ←[0m←[91mnpm ←[0m←[91minfo ←[0m←[91mlifecycle koa-react-isomorphic@2.14.2~build: koa-react-isomorphic@2.14.2 ←[0m

koa-react-isomorphic@2.14.2 build /opt/app gulp build

←[91msh: 1: gulp: Permission denied←[0m←[91m ←[0m←[91m ←[0m←[91mnpm ←[0m←[91minfo ←[0m←[91mlifecycle koa-react-isomorphic@2.14.2~build: Failed to exec build script ←[0m←[91mnpm ←[0m←[91mERR!←[0m←[91m Linux 4.4.24-boot2docker npm←[0m←[91m ERR!←[0m←[91m argv←[0m←[91m "/usr/local/bin/node" "/usr/local/bin/n pm" "run" "build" npm←[0m←[91m ERR!←[0m←[91m node←[0m←[91m v6.7.0 npm←[0m←[91m ERR!←[0m←[91m npm ←[0m←[91m v3.10.3 npm←[0m←[91m ERR!←[0m←[91m code←[0m←[91m ELIFECYCLE npm←[0m←[91m ERR!←[0m←[91m koa-react-isomorphic@2.14.2 build: gulp build npm←[0m←[91m ERR!←[0m←[91m Exit status 126 npm←[0m←[91m ERR!←[0m←[91m npm←[0m←[91m ERR!←[0m←[91m Failed at the koa-react-isomorphic@2.14.2 build scrip t 'gulp build'. npm←[0m←[91m ERR! Make sure you have the latest version of node.js and npm insta lled. npm←[0m←[91m ERR! If you do, this is most likely a problem with the koa-react-is omorphic package, npm ERR!←[0m←[91m not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! gulp build npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs koa-react-isomorphic ←[0m←[91mnpm ←[0m←[91mERR! Or if that isn't available, you can get their info vi a: ←[0m←[91mnpm ←[0m←[91mERR!←[0m←[91m npm owner ls koa-react-isomorphic ←[0m←[91mnpm←[0m←[91m ERR!←[0m←[91m There is likely additional logging output ab ove. ←[0m←[91m npm←[0m←[91m ERR!←[0m←[91m Please include the following file with any support re quest: npm←[0m←[91m ERR!←[0m←[91m /opt/app/npm-debug.log ←[0m←[31mERROR←[0m: Service 'webapp' failed to build: The command '/bin/sh -c np m run build' returned a non-zero code:

hung-phan commented 7 years ago

@PriyaBhatt13 can you paste the package.json file here?

PriyaBhatt13 commented 7 years ago

{ "name": "koa-react-isomorphic", "version": "2.14.2", "dependencies": { "babel-runtime": "^6.11.6", "bootstrap": "^3.3.7", "debug": "^2.2.0", "faker": "^3.1.0", "font-awesome": "^4.6.3", "immutable": "^3.8.1", "isomorphic-fetch": "^2.2.1", "jquery": "^3.1.1", "koa": "^2.0.0", "koa-bodyparser": "^3.2.0", "koa-compress": "^1.0.9", "koa-conditional-get": "^1.0.3", "koa-convert": "^1.2.0", "koa-cors": "0.0.16", "koa-csrf": "^3.0.4", "koa-etag": "^2.1.1", "koa-generic-session": "^1.11.3", "koa-helmet": "^2.0.0", "koa-html-minifier": "^1.0.1", "koa-logger": "^1.3.0", "koa-router": "^7.0.1", "koa-static": "^2.0.0", "lodash": "^4.16.2", "log4js": "^0.6.38", "marko": "^3.11.1", "react": "^15.3.2", "react-dom": "^15.3.2", "react-redux": "^4.4.5", "react-router": "^2.8.1", "react-router-redux": "^4.0.6", "recompose": "^0.20.2", "redial": "^0.5.0", "redux": "^3.6.0", "redux-actions": "^0.12.0", "redux-batched-updates": "^0.1.0", "redux-devtools": "^3.3.1", "redux-logger": "^2.6.1", "redux-thunk": "^2.1.0", "reselect": "^2.5.4", "rx": "^4.1.0" }, "devDependencies": { "babel-core": "^6.16.0", "babel-eslint": "^7.0.0", "babel-loader": "^6.2.5", "babel-plugin-module-resolver": "^2.2.0", "babel-plugin-rewire": "^1.0.0", "babel-plugin-transform-export-extensions": "^6.8.0", "babel-plugin-transform-react-constant-elements": "^6.9.1", "babel-plugin-transform-react-inline-elements": "^6.8.0", "babel-plugin-transform-react-remove-prop-types": "^0.2.9", "babel-plugin-transform-runtime": "^6.15.0", "babel-preset-es2015": "^6.16.0", "babel-preset-react": "^6.16.0", "babel-preset-stage-0": "^6.16.0", "bundle-loader": "^0.5.4", "chai": "^3.5.0", "chalk": "^1.1.3", "chokidar": "^1.6.0", "chokidar-cli": "^1.2.0", "compression-webpack-plugin": "^0.3.1", "css-loader": "^0.25.0", "del": "^2.2.2", "enzyme": "^2.4.1", "eslint": "^3.6.1", "eslint-config-airbnb": "^12.0.0", "eslint-import-resolver-babel-module": "^2.0.1", "eslint-import-resolver-webpack": "^0.6.0", "eslint-loader": "^1.5.0", "eslint-plugin-flowtype": "^2.19.0", "eslint-plugin-import": "^2.0.0", "eslint-plugin-jsx-a11y": "^2.2.2", "eslint-plugin-mocha": "^4.5.1", "eslint-plugin-react": "^6.3.0", "eslint-watch": "^2.1.14", "estraverse": "^4.2.0", "estraverse-fb": "^1.3.1", "exports-loader": "^0.6.3", "expose-loader": "^0.7.1", "extract-text-webpack-plugin": "^2.0.0-beta.1", "file-loader": "^0.9.0", "flow-bin": "^0.33.0", "gulp": "^3.9.1", "gulp-env": "^0.4.0", "gulp-util": "^3.0.7", "imports-loader": "^0.6.5", "istanbul": "^1.0.0-alpha.2", "jsdom": "^9.5.0", "jsdom-global": "^2.1.0", "json-loader": "^0.5.4", "less": "^2.7.1", "less-loader": "^2.2.3", "mocha": "^3.1.0", "nock": "^8.0.0", "node-inspector": "^0.12.8", "node-sass": "^3.10.0", "nodemon": "^1.10.2", "offline-plugin": "^3.4.2", "pm2": "^2.0.18", "postcss-cssnext": "^2.8.0", "postcss-loader": "^0.13.0", "react-addons-test-utils": "^15.3.2", "react-hot-loader": "^3.0.0-beta.5", "react-proxy-loader": "^0.3.4", "redux-mock-store": "^1.2.1", "regenerator-runtime": "^0.9.5", "sass-loader": "^4.0.2", "script-loader": "^0.7.0", "shelljs": "^0.7.4", "style-loader": "^0.13.1", "supertest": "^2.0.0", "testdouble": "^1.7.0", "url-loader": "^0.5.7", "webpack": "^2.1.0-beta.25", "webpack-dev-server": "^2.1.0-beta.0", "webpack-isomorphic-tools": "^2.5.8", "webpack-node-externals": "^1.4.3" }, "engines": { "node": ">= 6.0.0", "npm": ">=3.0.0" }, "files": [ "app", "build", "config", "public", "scripts", "Dockerfile", "Procfile", "compiler.js", "docker-compose.yml", "gulpfile.js", "marko.json", "nodemon.json", "package.json", "prod-server.json" ], "keywords": [ "es6", "isomorphic", "koa", "mocha", "ramda", "react", "redux", "relay", "rxjs", "universal" ], "license": "MIT", "scripts": { "build": "gulp build", "compile-templates": "markoc ./app/server/templates", "debug": "./scripts/debug", "dev": "./scripts/dev", "flow:status": "flow status; test $? -eq 0 -o $? -eq 2", "flow:stop": "flow stop", "flow:watch": "npm run flow:status && chokidar './app/*/.js' './app/**/_.jsx' './tests/_/.js' -c 'npm run flow:status'", "frontend:watch": "webpack-dev-server --config config/webpack/client/development.js", "pm2:delete": "pm2 delete config/pm2/production.json", "pm2:start": "pm2 start config/pm2/production.json", "postinstall": "./scripts/postinstall", "start": "./scripts/start", "test": "./scripts/test", "test:coverage": "./scripts/test-coverage", "test:lint": "./scripts/test-lint", "test:watch": "./scripts/test-watch", "watch": "gulp clean && gulp frontend:watch & gulp backend:watch" } }

tmtxt commented 7 years ago

You can temporarily fix this by moving the ENV instruction after the the npm install like this

screen shot 2016-10-18 at 13 23 23
hung-phan commented 7 years ago

I just update it with version 2.14.3. Can you try again @PriyaBhatt13 ?

PriyaBhatt13 commented 7 years ago

I have tried with version 2.14.3 . I am still facing same issue.

Step 8 : ENV NODE_ENV production SECRET_KEY secret ---> Running in 71300a6d6a6a ---> b2275b310567 Removing intermediate container 71300a6d6a6a Step 9 : COPY . . ---> 4735feb925d7 Removing intermediate container a7488acc64ae Step 10 : RUN npm run build ---> Running in 7d75ff528a14 ←[91mnpm←[0m←[91m info←[0m←[91m it worked if it ends with←[0m←[91m ok npm←[0m←[91m info←[0m←[91m using←[0m←[91m npm@3.10.3 npm←[0m←[91m info←[0m←[91m using←[0m←[91m node@v6.7.0 ←[0m←[91mnpm ←[0m←[91minfo ←[0m←[91mlifecycle koa-react-isomorphic@2.14.3~prebui ld: koa-react-isomorphic@2.14.3 ←[0m←[91mnpm ←[0m←[91minfo ←[0m←[91mlifecycle koa-react-isomorphic@2.14.3~build: koa-react-isomorphic@2.14.3 ←[0m

koa-react-isomorphic@2.14.3 build /opt/app gulp build

←[91msh: 1: gulp: Permission denied←[0m←[91m ←[0m←[91m ←[0m←[91mnpm ←[0m←[91minfo ←[0m←[91mlifecycle koa-react-isomorphic@2.14.3~build: Failed to exec build script ←[0m←[91mnpm ←[0m←[91mERR! Linux 4.4.24-boot2docker ←[0m←[91mnpm ←[0m←[91mERR! ←[0m←[91margv "/usr/local/bin/node" "/usr/local/bin/n pm" "run" "build" ←[0m←[91mnpm ←[0m←[91mERR! ←[0m←[91mnode v6.7.0 ←[0m←[91mnpm ←[0m←[91mERR! ←[0m←[91mnpm v3.10.3 ←[0m←[91mnpm ←[0m←[91mERR! ←[0m←[91mcode ELIFECYCLE ←[0m←[91mnpm ←[0m←[91mERR! koa-react-isomorphic@2.14.3 build: gulp build ←[0m←[91mnpm ←[0m←[91mERR! Exit status 126 ←[0m←[91mnpm ←[0m←[91mERR! ←[0m←[91mnpm ←[0m←[91mERR! Failed at the koa-react-isomorphic@2.14.3 build scrip t 'gulp build'. npm←[0m←[91m ERR! Make sure you have the latest version of node.js and npm insta lled. npm←[0m←[91m ERR! If you do, this is most likely a problem with the koa-react-is omorphic package, npm ERR!←[0m←[91m not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! gulp build npm ERR! You can get information on how to open an issue for this project with: ←[0m←[91mnpm ←[0m←[91mERR! npm bugs koa-react-isomorphic ←[0m←[91mnpm ←[0m←[91mERR! Or if that isn't available, you can get their info vi a: ←[0m←[91mnpm ←[0m←[91mERR!←[0m←[91m npm owner ls koa-react-isomorphic ←[0m←[91mnpm←[0m←[91m ERR!←[0m←[91m There is likely additional logging output ab ove. ←[0m←[91m npm←[0m←[91m ERR!←[0m←[91m Please include the following file with any support re quest: npm←[0m←[91m ERR!←[0m←[91m /opt/app/npm-debug.log ←[0m←[31mERROR←[0m: Service 'webapp' failed to build: The command '/bin/sh -c np m run build' returned a non-zero code: 1

@hung-phan

hung-phan commented 7 years ago

ok. checking, looks like it causes by permission. On other test machines I got the error command not found, but it was fixed with v2.13.3

hung-phan commented 7 years ago

@PriyaBhatt13 I just launch 2 instances with aws and digital ocean to test but I don't have the permission error above. Can you run this command docker build --no-cache .?