Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"$NODE_ENV" was unexpected at this time. Error on npm install (windows) #63

Closed
aylabyuk opened this issue Mar 8, 2017 · 12 comments
Closed

Comments

@aylabyuk
Copy link

aylabyuk commented Mar 8, 2017

I am running on windows 10 with the latest node and npm but when I tried to npm install the package it produce an error "$NODE_ENV" was unexpected at this time. I have tried to install it on ubuntu and it works fine. It only happens on windows. Any ideas why?

@larixer
Copy link
Member

larixer commented Mar 8, 2017

Hi @aylabyuk,

Logs would be helpful, to understand whats happening

@larixer
Copy link
Member

larixer commented Mar 8, 2017

Though I bet the problem is caused by commands inside "scripts", e.g. by this construction:
"start": "if [ \"$NODE_ENV\" = production ]; then

@aylabyuk
Copy link
Author

aylabyuk commented Mar 8, 2017

sorry here is the log from npm-debug.log file

here is the start of the error.

97 error Windows_NT 10.0.14393
98 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "i"
99 error node v7.7.1
100 error npm v4.1.2
101 error code ELIFECYCLE
102 error apollo-fullstack-starter-kit@1.0.0 postinstall: if [ "$NODE_ENV" = production ]; then npm run clean && npm run build && npm run migrate && npm run seed; fi
102 error Exit status 1
103 error Failed at the apollo-fullstack-starter-kit@1.0.0 postinstall script 'if [ "$NODE_ENV" = production ]; then npm run clean && npm run build && npm run migrate && npm run seed; fi'.
103 error Make sure you have the latest version of node.js and npm installed.
103 error If you do, this is most likely a problem with the apollo-fullstack-starter-kit package,
103 error not with npm itself.
103 error Tell the author that this fails on your system:
103 error if [ "$NODE_ENV" = production ]; then npm run clean && npm run build && npm run migrate && npm run seed; fi
103 error You can get information on how to open an issue for this project with:
103 error npm bugs apollo-fullstack-starter-kit
103 error Or if that isn't available, you can get their info via:
103 error npm owner ls apollo-fullstack-starter-kit
103 error There is likely additional logging output above.
104 verbose exit [ 1, true ]

larixer added a commit that referenced this issue Mar 8, 2017
@larixer
Copy link
Member

larixer commented Mar 8, 2017

@aylabyuk I've pushed commit that might fix this issue. Unfortunately right now I can't test it under Windows. Could you update source code, try under Windows and report back?

@aylabyuk
Copy link
Author

aylabyuk commented Mar 8, 2017

@Vlasenko I have updated the code and run npm install --save-dev if-env. still have issue installing

here is the error log:

97 error Windows_NT 10.0.14393
98 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "i"
99 error node v7.7.1
100 error npm v4.1.2
101 error code ELIFECYCLE
102 error apollo-fullstack-starter-kit@1.0.0 postinstall: if-env NODE_ENV=production && npm run clean && npm run build && npm run migrate && npm run seed
102 error Exit status 1
103 error Failed at the apollo-fullstack-starter-kit@1.0.0 postinstall script 'if-env NODE_ENV=production && npm run clean && npm run build && npm run migrate && npm run seed'.
103 error Make sure you have the latest version of node.js and npm installed.
103 error If you do, this is most likely a problem with the apollo-fullstack-starter-kit package,
103 error not with npm itself.
103 error Tell the author that this fails on your system:
103 error if-env NODE_ENV=production && npm run clean && npm run build && npm run migrate && npm run seed
103 error You can get information on how to open an issue for this project with:
103 error npm bugs apollo-fullstack-starter-kit
103 error Or if that isn't available, you can get their info via:
103 error npm owner ls apollo-fullstack-starter-kit
103 error There is likely additional logging output above.
104 verbose exit [ 1, true ]

larixer added a commit that referenced this issue Mar 8, 2017
larixer added a commit that referenced this issue Mar 8, 2017
larixer added a commit that referenced this issue Mar 8, 2017
@larixer
Copy link
Member

larixer commented Mar 8, 2017

I think now the scripts are Windows-friendly. Please clone the latest version of this repo and check.

larixer added a commit that referenced this issue Mar 8, 2017
@larixer
Copy link
Member

larixer commented Mar 8, 2017

Actually slightly changing Getting Started steps, I've managed to make scripts sections easier then it was, yet keeping them cross-platform.

@aylabyuk
Copy link
Author

aylabyuk commented Mar 8, 2017

@Vlasenko thank you for the effort. I will test this out as soon as I get back to office where I use windows. I cant test it right now since my personal computer runs on ubuntu. I will let you know then. By the way this is a cool project..kudos.

@josephdburdick
Copy link
Contributor

Perhaps instead of using an inline conditional statement there could be separate npm scripts and/or the use of concurrently. I think it would help alleviate ambiguity.

@larixer
Copy link
Member

larixer commented Mar 8, 2017

@josephdburdick I think right now it is done like you describe :) The start target has been split into start and watch. And instead of using postinstall for Heroku, now heroku-postbuild is utilized instead.

@josephdburdick
Copy link
Contributor

puts on 👓

so it has! 👍

@larixer
Copy link
Member

larixer commented Mar 10, 2017

@aylabyuk Could you confirm, if it works for you or no?

@larixer larixer closed this as completed Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants