ocsigen / ocsigen-start

Ocsigen-start: Higher-level library to develop Web and mobile applications with users, (pre)registration, notifications, etc.
Other
75 stars 32 forks source link

ocsigen-start 2.18.0 to 2.19.2 - postcss module problem #603

Closed MdeLv closed 4 years ago

MdeLv commented 4 years ago

Following the very recent upgrade of ocsigen-start 2.18.0 to 2.19.2, here is the error when building the wabapp. Have you any idea of how to fix that? Thanks

With ocaml.4.10.0 OR ocaml.4.11.1

$ opam upgrade
upgrade   ocsigen-start                 2.18.0 to 2.19.2

$ make test.byte

cp /home/test//home/test/.opam/4.10.0/share/ocsigen-toolkit/css/ot_buttons.css /home/test/.opam/4.10.0/share/ocsigen-too
lkit/css/ot_carousel.css /home/test/.opam/4.10.0/share/ocsigen-toolkit/css/ot_tongue.css /home/test/.opam/4.1
0.0/share/ocsigen-toolkit/css/ot_sticky.css /home/test/.opam/4.10.0/share/ocsigen-toolkit/css/ot_datetime.c
ss /home/test/.opam/4.10.0/share/ocsigen-toolkit/css/ot_drawer.css /home/test/.opam/4.10.0/share/ocsigen-tool
kit/css/ot_icons.css /home/test/.opam/4.10.0/share/ocsigen-toolkit/css/ot_picture_uploader.css /home/test/.op
am/4.10.0/share/ocsigen-toolkit/css/ot_popup.css /home/test/.opam/4.10.0/share/ocsigen-toolkit/css/ot_spinn
er.css /home/test/.opam/4.10.0/share/ocsigen-toolkit/css/ot_page_transition.css static/css                 
touch static/css/.import-external-css                                                                    
[ -d sass ] && \                                                                                         
SASS_PATH=sass/lib:static/css sass --style compressed sass/test41.scss static/defaultcss/test41.css      
node_modules/.bin/postcss --use autoprefixer --replace static/defaultcss/test41.css                      
internal/modules/cjs/loader.js:905                                                                       
  throw err;                                                                                             
  ^                                                                                                      

Error: Cannot find module 'postcss'                                                                      
Require stack:                                                                                           
- /home/test/Documents/ocsigen-start/test41/node_modules/postcss-cli/index.js                              
- /home/test/Documents/ocsigen-start/test41/node_modules/postcss-cli/bin/postcss                           
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)                          
    at Function.Module._load (internal/modules/cjs/loader.js:747:27)                                     
    at Module.require (internal/modules/cjs/loader.js:974:19)                                            
    at require (internal/modules/cjs/helpers.js:88:18)                                                   
    at Object.<anonymous> (/home/test/Documents/ocsigen-start/test41/node_modules/postcss-cli/index.js:13:1
7)                                                                                                       
    at Module._compile (internal/modules/cjs/loader.js:1085:30)                                          
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)                            
    at Module.load (internal/modules/cjs/loader.js:950:32)                                               
    at Function.Module._load (internal/modules/cjs/loader.js:791:14)                                     
    at Module.require (internal/modules/cjs/loader.js:974:19) {                                          
  code: 'MODULE_NOT_FOUND',                                                                              
  requireStack: [                                                                                        
    '/home/test/Documents/ocsigen-start/test41/node_modules/postcss-cli/index.js',                         
    '/home/test/Documents/ocsigen-start/test41/node_modules/postcss-cli/bin/postcss'                       
  ]                                                                                                      
}                                                                                                        
make: *** [Makefile.style:72: static/defaultcss/test41.css] Error 1                                      
MdeLv commented 4 years ago

With ocaml.4.10.0, doing make test.byte just one or two more time was enough to get web app compilation completed. With ocaml.4.11.1, the same trick worked. Several tests showed that doing two additional make test.byte or make test.opt is necessary (a total of three times).

I could reproduce the same behavior with a new ocsigen start web app. It seems related no npm install post-cli and npm install autoprefixer.

Can you observe the same behavior? Is seems to be a npm related issue (I'm not aware of all the npm stuff). How to fix that?

jrochel commented 4 years ago

Could you try installing autoprefixer@9.8.6 and postcss@7.*? I think that postcss@8.* may be causing problems, and autoprefixer@10.* depends on postcss@8.*.

MdeLv commented 4 years ago

I just tried the following:

npm install postcss@7.0.35

npm WARN saveError ENOENT: no such file or directory, open '/home/test/Documents/ocsigen-start/package.json'                                                                                                        
npm WARN enoent ENOENT: no such file or directory, open '/home/test/Documents/ocsigen-start/package.json'  
npm WARN postcss-cli@8.1.0 requires a peer of postcss@^8.0.0 but none is installed. You must install peer dependencies yourself.                                                                                  
npm WARN postcss-reporter@7.0.1 requires a peer of postcss@^8.1.0 but none is installed. You must install peer dependencies yourself.                                                                             
npm WARN ocsigen-start No description                                                                    
npm WARN ocsigen-start No repository field.                                                              
npm WARN ocsigen-start No README data                                                                    
npm WARN ocsigen-start No license field.                                                                 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):                  
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})                                                 

+ postcss@7.0.35                                                                                         
updated 1 package and audited 176 packages in 1.653s                                                     

$ npm install autoprefixer@9.8.6                                         
npm WARN saveError ENOENT: no such file or directory, open '/home/test/Documents/ocsigen-start/package.json'                                                                                                        
npm WARN enoent ENOENT: no such file or directory, open '/home/test/Documents/ocsigen-start/package.json'  
npm WARN postcss-cli@8.1.0 requires a peer of postcss@^8.0.0 but none is installed. You must install peer dependencies yourself.                                                                                  
npm WARN postcss-reporter@7.0.1 requires a peer of postcss@^8.1.0 but none is installed. You must install peer dependencies yourself.                                                                             
npm WARN ocsigen-start No description                                                                    
npm WARN ocsigen-start No repository field.                                                              
npm WARN ocsigen-start No README data                                                                    
npm WARN ocsigen-start No license field.                                                                 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):                  
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})                                                 

+ autoprefixer@9.8.6                                                                                     
updated 1 package and audited 176 packages in 1.793s          

Then I tried make test.byte (with db already up&running). I got the same behavior as described before (an error, then two additional make test.byte "fixed" the issue).

Could you reproduce the same behavior? I alert you that I'm unaware of that npm stuff.

jrochel commented 4 years ago

Oh, in fact I can reliably reproduce this with a fresh app created with eliom-distillery. I'll look into it.

jrochel commented 4 years ago

Alright, I fixed the problem by specifying in the Makefile.style versions of autoprefixer and postcss that are known to work. (see https://github.com/ocsigen/ocsigen-start/commit/8cf836555c42243020397dbbee9992d859f69514)

A new version of ocsigen-start with this fix will be released soon. (https://github.com/ocaml/opam-repository/pull/17396)

In the meantime you can apply the change in the above commit to your project by hand.

MdeLv commented 4 years ago

Fixed and already on opam repository. Thank you.