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

npm run build broken on Windows #7

Closed
IBwWG opened this issue Dec 30, 2016 · 17 comments
Closed

npm run build broken on Windows #7

IBwWG opened this issue Dec 30, 2016 · 17 comments

Comments

@IBwWG
Copy link

IBwWG commented Dec 30, 2016

With the latest node (7), npm, and fsrrlr just downloaded today, npm run build gives:

...
> rm -rf ./public/dist

'rm' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v7.3.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] prebuild: `rm -rf ./publ
ic/dist`
npm ERR! Exit status 1
...

(but the dev env launches fine BTW, awesome work :) )

@eddyystop
Copy link
Owner

Thanks for catching this.

Scheduling a fix. You can change the command to rimraf and add rimraf to package.json.

@IBwWG
Copy link
Author

IBwWG commented Dec 30, 2016

Wow. You're fast! Thanks!

@eddyystop
Copy link
Owner

Fixed in 0.3.0.

Instead of npm run build:dev or npm run start:dev, etc., on Windows you have to use win:build:dev and win"start:dev.

I'd be interested knowing if there is a way to set an environment variable in Windows for a single command.

@IBwWG
Copy link
Author

IBwWG commented Dec 30, 2016

Super!

Maybe http://superuser.com/a/950944/7995 ?

@IBwWG
Copy link
Author

IBwWG commented Dec 30, 2016

OK, I guess I skimmed your message before. Now that I go to try it, I notice that you're talking about the dev environment--but that was already working. It's only the instructions for production that broke.

Anyway, after upgrading to 0.3.0 and trying npm run win:build I get this:

> set NODE_ENV=production && webpack --config webpack.production.config.js --his
tory-api-fallback --progress --colors

================================
 Invalid environment variables:
    NODE_ENV: Value "production " not in choices [production,prod,development,de
v,devserver,testing,test]

 Exiting with error code 1
================================

(Notice the extra space after production in the quotes...)

@eddyystop
Copy link
Owner

Thanks for http://superuser.com/a/950944/7995 . I Googled and asked a half dozen people without getting a solution.

The cmd string would need a cd to the current folder, I'd have to test if nested npm scripts work properly, and it feels like starting a new session for something like this is overkill.

Interesting none the less.

I think I'll stick with using set.

@IBwWG
Copy link
Author

IBwWG commented Dec 31, 2016

No prob, sometimes the right Google incantation does not come to a person. Glad to provide something of interest. :)

@IBwWG IBwWG changed the title npm run build tries non-existent 'rm' command on Windows npm run build broken on Windows Dec 31, 2016
@eddyystop
Copy link
Owner

Removed the trailing blank being added to the Windows' env vars.

Sorry I can't test as I don't have a Node Windows set up anymore.

Pushed with 0.3.1.

@IBwWG
Copy link
Author

IBwWG commented Dec 31, 2016

I'll test...

@IBwWG
Copy link
Author

IBwWG commented Dec 31, 2016

npm run win:build:dev gives:

> [email protected] win:build:dev C:\Users\me\fsrrl
r
> set NODE_ENV=development&& webpack --config webpack.production.config.js --his
tory-api-fallback --progress --colors

----- DEVELOPMENT build.
Hash: 6bd3cea634d0146d7f37
Version: webpack 1.14.0
Time: 52038ms
                                  Asset       Size  Chunks             Chunk Nam
es
    main.bundle.65c097d7e3775eaa6ecd.js    2.71 MB       0  [emitted]  main
main.bundle.65c097d7e3775eaa6ecd.js.map    3.27 MB       0  [emitted]  main
                             index.html  793 bytes          [emitted]
   [0] multi main 28 bytes {0} [built]
    + 962 hidden modules

ERROR in ../~/react-tap-event-plugin/src/injectTapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventPluginHub' in C:\
Users\me\fsrrlr\node_modules\react-tap-event-plugin\src
 @ ../~/react-tap-event-plugin/src/injectTapEventPlugin.js 23:2-37

ERROR in ../~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventConstants' in C:\
Users\me\fsrrlr\node_modules\react-tap-event-plugin\src
 @ ../~/react-tap-event-plugin/src/TapEventPlugin.js 22:21-56

ERROR in ../~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventPluginUtils' in C
:\Users\me\fsrrlr\node_modules\react-tap-event-plugin\src
 @ ../~/react-tap-event-plugin/src/TapEventPlugin.js 23:23-60

ERROR in ../~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventPropagators' in C
:\Users\me\fsrrlr\node_modules\react-tap-event-plugin\src
 @ ../~/react-tap-event-plugin/src/TapEventPlugin.js 24:23-60

ERROR in ../~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/SyntheticUIEvent' in C
:\Users\me\fsrrlr\node_modules\react-tap-event-plugin\src
 @ ../~/react-tap-event-plugin/src/TapEventPlugin.js 25:23-60

ERROR in ../~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/ViewportMetrics' in C:
\Users\me\fsrrlr\node_modules\react-tap-event-plugin\src
 @ ../~/react-tap-event-plugin/src/TapEventPlugin.js 27:22-58
Child html-webpack-plugin for "index.html":
        + 3 hidden modules

@IBwWG
Copy link
Author

IBwWG commented Dec 31, 2016

But, npm run win:start:dev does work now. So does npm run win:start:devserver. In fact, only the latter will serve pages correctly (the former renders blank.)

@IBwWG
Copy link
Author

IBwWG commented Dec 31, 2016

Per #11 (comment) , npm run win:build:devserver also works. Everything working in dev mode!

@IBwWG
Copy link
Author

IBwWG commented Dec 31, 2016

Hmm, production seems broken though. npm run win:build gives the same errors as in #7 (comment) . npm win:start isn't a defined command, and npm run win:start gives this:

> [email protected] win:start C:\Users\me\fsrrlr
> set NODE_ENV=production&& node server/index.js

16:56:01 - info: ==============================================================
16:56:01 - info: Server initialization started in PRODUCTION mode. tags=server
16:56:01 - info: ==============================================================
16:56:01 - info: Env vars NODE_ENV=production, PORT=3030, LOG_LEVEL=silly, LOG_C
ONSOLE_LEVEL=silly, tags=server
16:56:01 - info: App config isProduction=true, NODE_ENV=production, DEBUG=undefi
ned, host=localhost, port=3030, publicPath=C:\Users\me\fsrrlr\publi
c, logLevel=silly, path=C:\Users\me\fsrrlr\logs, fileName=server.lo
g, logConsoleLevel=silly, secret=1234567890, , appName=Feathers-starter-react-re
dux-login-roles, defaultRoute=/app, path=C:\Users\me\fsrrlr\data, i
dName=_id, forFirstUser=superAdmin admin, default=, allowedToChangeRoles=[superA
dmin, admin], signUpEmailTokenTimeValid=86400000, signUpEmailTokenTimeValidText=
24 hours, forgotPasswordEmailTokenTimeValid=1800000, forgotPasswordEmailTokenTim
eValidText=30 minutes, productName=[feathers-starter-react-redux-login-roles], p
roductUrl=[http://feathers-starter.feathersjs.com], senderName=[Feathers Starter
], fromEmail=[Feathers Starter <[email protected]>], supportEmail=[St
arter Support <[email protected]>], copyrightYears=2015-2016, fromEma
[email protected], postmarkApiToken=00917934-dbe7-4883-bedc-12b93fc4c7c59, re=^[\sa
-zA-Z]{8,30}$, err=Name must be 8 or more letters or spaces., re=^[a-zA-Z0-9]{5,
30}$, err=Username must be 5 or more letters and numbers., re=^[\sa-zA-Z0-9]{8,3
0}$, err=Password must be 8 or more letters, numbers and embedded blanks., re=[a
-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z
0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?, err=Email is invalid., minL
en=8, maxLen=30, errLen=Email must be 8 or more characters., clientBuiltFor=null
, deviceId=null, defaultRoute=/app, allowedToChangeRoles=[superAdmin, admin], si
gnUpEmailTokenTimeValidText=24 hours, forgotPasswordEmailTokenTimeValidText=30 m
inutes, productName=[feathers-starter-react-redux-login-roles], productUrl=[http
://feathers-starter.feathersjs.com], senderName=[Feathers Starter], fromEmail=[F
eathers Starter <[email protected]>], supportEmail=[Starter Support <
[email protected]>], copyrightYears=2015-2016, re=^[\sa-zA-Z]{8,30}$,
 err=Name must be 8 or more letters or spaces., re=^[a-zA-Z0-9]{5,30}$, err=User
name must be 5 or more letters and numbers., re=^[\sa-zA-Z0-9]{8,30}$, err=Passw
ord must be 8 or more letters, numbers and embedded blanks., re=[a-z0-9!#$%&'*+/
=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9]
)?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?, err=Email is invalid., minLen=8, maxLen=3
0, errLen=Email must be 8 or more characters., clientBuiltFor=null, deviceId=nul
l, tags=server
16:56:02 - info: Server listening on port 3030 tags=server
16:56:02 - error: uncaughtException: ENOENT: no such file or directory, open 'C:
\Users\me\fsrrlr\logs\server.log' date=Sat Dec 31 2016 16:56:02 GMT
+0100 (W. Europe Standard Time), pid=6528, uid=null, gid=null, cwd=C:\Users\me\fs
rrlr, execPath=C:\Program Files\nodejs\node.exe, version=v7.3.0, a
rgv=[C:\Program Files\nodejs\node.exe, C:\Users\me\fsrrlr\server\in
dex.js], rss=58523648, heapTotal=39825408, heapUsed=27533688, external=611746, l
oadavg=[0, 0, 0], uptime=115953.5628963, trace=[], stack=[Error: ENOENT: no such
 file or directory, open 'C:\Users\me\fsrrlr\logs\server.log']


=== uncaught exception =================
ENOENT: no such file or directory, open 'C:\Users\me\fsrrlr\logs\se
rver.log'
Error: ENOENT: no such file or directory, open 'C:\Users\me\fsrrlr\
logs\server.log'
========================================


16:56:02 - error: Uncaught exception. Exiting. message=ENOENT: no such file or d
irectory, open 'C:\Users\me\fsrrlr\logs\server.log', stack=[Error:
ENOENT: no such file or directory, open 'C:\Users\me\fsrrlr\logs\se
rver.log'], tags=exit
16:56:02 - error: ========================================
16:56:02 - error: Exit Process code=100, tags=exit
16:56:02 - error: ========================================

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "run" "win:start"
npm ERR! node v7.3.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] win:start: `set NODE_ENV
=production&& node server/index.js`
npm ERR! Exit status 100

@eddyystop
Copy link
Owner

eddyystop commented Dec 31, 2016

OK. One thing at a time.

(1) Did you perhaps update to a newer version of React?

In /client/index.js remove line 12 import './utils/react-tap-event'; Please confirm that removes the react-tap-event-plugin errors in npm run win:build:dev.

react-tap-event may no longer be needed as per its README:

You've probably heard of iOS's dreaded 300ms tap delay. ... 

Facebook is not planning on supporting tap events (#436) because browsers are fixing/removing the click delay. Unfortunately it will take a lot of time before all mobile browsers (including iOS' UIWebView) will and can be updated.

Verify if you need this plugin for the browsers you need to support.

(2) "npm run win:build gives the same errors as in #7 (comment) "
Above should handle this also.

(3) "npm run win:startgives this:" The repo containslogs/server.log`. I suspect its been deleted.

(4) "In fact, only the latter will serve pages correctly (the former renders blank.)"
Leaving this aside for now.

@eddyystop eddyystop reopened this Dec 31, 2016
@IBwWG
Copy link
Author

IBwWG commented Jan 3, 2017

(1 & 2) I hadn't updated that I know of (npm list says I'm on 15.4.1). Thanks, I'd missed that in the readme, and commenting that line resulted in a successful build!

(3) OK...but not by me :) Am I supposed to just touch it or something? Isn't it just autogenerated in the first place?

(4) OK :)

@IBwWG
Copy link
Author

IBwWG commented Jan 3, 2017

(3) Actually logs\ didn't exist. I did mkdir logs and now the server starts. Hooray! (But the script should probably do that itself.)

@eddyystop
Copy link
Owner

I created an issue.

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

2 participants