scratchfoundation / scratch-blocks

Scratch Blocks is a library for building creative computing interfaces.
https://scratch.mit.edu/developers
Apache License 2.0
2.59k stars 1.38k forks source link

npm install #1620

Open jyh129143 opened 6 years ago

jyh129143 commented 6 years ago

Expected Behavior

scratch-blocks be compiled properly

Actual Behavior

_20180704095508

note that the Chinese character(“命令行太长。”) in the screenshot can be interpreter into:command line(s) be too long

image

Steps to Reproduce

1.git clone from scratch-blocks 2.fix the buil.py file of scratch-blocks in line 355 and in line 598(adding code "shell=True"); proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) 355 test_proc = subprocess.Popen(test_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) 598 3.npm install

Operating System and Browser

windows7 python :2.7.15 npm:6.1.0

jyh129143 commented 6 years ago

I wonder if the log above mean a successful compiling.However,I can't run it well with scratch-gui.So I think it failed.Then what may result into the failure and how to deal with it?

jyh129143 commented 6 years ago

step 2 has a mistake,the file I fixed should be build.py not buil.py

lishuai199502 commented 6 years ago

give me five~i have the same problem

thisandagain commented 6 years ago

It looks like the build succeeded, but with a JSDoc warning that may have caused the build process to exit with a non-zero status code. We can take a look.

rachel-fenichel commented 6 years ago

For what it's worth, that JSDoc warning has been there for a long time (I keep meaning to delete the annotation but not getting around to it). If this is a new issue that's likely not the culprit. Worth removing to clean up output, though.

jyh129143 commented 6 years ago

So,may I make the conclusion that I have made a successful building despite the error message saying that, npm ERR! scratch-blocks@0.1.0 prepublish: python build.py && webpack & npm ERR! Failed at the scratch-blocks@0.1.0 prepublish script.

waterzhang0423 commented 6 years ago

@jyh129143 I have the exact same problem. I guess maybe blockly_compressed_horizontal.js and blockly_compressed_vertical.js were not generated correctly when run build.py on Windows. They would be generated automatically on macOS, see the picture below:

wx20180726-172339

So, first I built it on my Mac, then copied blockly_compressed_horizontal.js and blockly_compressed_vertical.js to the scratch-blocks directory on Windows, then run npm install, and it just worked.

jyh129143 commented 6 years ago

@waterzhang0423 maybe your idea is right,I also made it success in mac. @thisandagain perhaps you should pay some attention to this problem

xmeow commented 6 years ago

In my experience there is a command line length limit in windows, only parts of goog libs actually compressed.

jyh129143 commented 6 years ago

@xmeow Things seems to be that

nekketsuuu commented 6 years ago

As just a side note, my build was succeeded with no patch on Windows 10. The steps are the followings:

  1. Create a working directory and move into it: mkdir scratch-dev, cd scratch-dev
  2. Clone scratch-blocks: git clone https://github.com/LLK/scratch-blocks.git
  3. Clone closure-library on the same directory as Blockly's official guide of Closure says: git clone https://github.com/google/closure-library.git
  4. cd scratch-blocks
  5. npm install

(I created a new clone of closure-library. Instead, you can make a simlink of NPM's closure-library. See rschamp's comment.)

@jyh129143 Would you tell us how you installed closure-library? Perhaps it's different from my method because your log says that you used a local compiler, whereas mine says I used a remote one.

Environment

jie1995 commented 5 years ago

I haven't solved the problem. qwq

JiangLiruii commented 5 years ago

still in this trouble.....orz

lucky2009 commented 5 years ago

@nekketsuuu I try it ,but it still doesn`t wokr well image

who have solved the problem?

JiangLiruii commented 5 years ago

@nekketsuuu I try it ,but it still doesn`t wokr well image

who have solved the problem?

I solve this problem but still has "command line too long" issue. you can change followings to try 1 change compile mode: CLOSURE_COMPILER_NPM = "google-closure-compiler.cmd" if platform.system() == "Windows" else "google-closure-compiler" 2 add google-closure-compiler.cmd in system PATH, which in ./node_mudules/.bin 3 change string to compiler var CLOSURE_COMPILER_NPM for group in [[CLOSURE_COMPILER_NPM], dash_args]: 3 add shell=Truein this linetest_proc = subprocess.Popen(test_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) then , you can resolve this problem but.... still 命令行太长

nekketsuuu commented 5 years ago

@lucky2009 @JiangLiruii If you want to resolve this issue, more information of your environment will be needed. Because most people was not affected by this problem, a cause of this may be related to your particular configuration. So would you write down your environment and your build procedure as much as possible, please?

JiangLiruii commented 5 years ago

@lucky2009 @JiangLiruii If you want to resolve this issue, more information of your environment will be needed. Because most people was not affected by this problem, a cause of this may be related to your particular configuration. So would you write down your environment and your build procedure as much as possible, please?

Sure

OS: win 10 Home
node: v10.15.3
python: 2.7.16
yarn: 1.13.0
npm: 6.4.1
java: 11.0.2

Procedure: clone repo scratch-blocks, change the build.py file's lines as I written before 2 level, you can check the build.py file I attached, then, I can run correctly from beginning, but in compiling procecing, still has error for 命令行太长.

Appreciate for your reply. build.py.zip

nekketsuuu commented 5 years ago

@JiangLiruii Thanks for your information! Maybe more information is needed. What is your shell/terminal (cmd.exe, PowerShell, ConEmu, etc...)? What is your version and build number of Windows 10? What is your scratch-blocks' Git revision SHA-1 hash? Without modification of build.py, what is the whole error message (please copy and paste it as text, not upload its screenshot because we cannot simply copy the error message from a screenshot). I want to reproduce your problem, but I couldn't. It would be appreciated if you add more other configurations if you think it may be related to the problem.

JiangLiruii commented 5 years ago

@JiangLiruii Thanks for your information! Maybe more information is needed. What is your shell/terminal (cmd.exe, PowerShell, ConEmu, etc...)? What is your version and build number of Windows 10? What is your scratch-blocks' Git revision SHA-1 hash? Without modification of build.py, what is the whole error message (please copy and paste it as text, not upload its screenshot because we cannot simply copy the error message from a screenshot). I want to reproduce your problem, but I couldn't. It would be appreciated if you add more other configurations if you think it may be related to the problem.

Without modification of build.py, the error message is

Traceback (most recent call last):
  File ".\build.py", line 574, in <module>
    test_proc = subprocess.Popen(test_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  File "C:\Python27\lib\subprocess.py", line 394, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 644, in _execute_child
    startupinfo)
WindowsError: [Error 2]

win 10 build number: 1809, OS internal version: 17763.503.

I can promise It's an absolute reproduced problem, we have tried on our 5 computers, our walk around is using linux, and mac os, which gives us some inconvenience. Hopefully you can help us solve it. Thanks a lot. build.py file without modified is attached in case any code update. build.py.zip

JiangLiruii commented 5 years ago

As just a side note, my build was succeeded with no patch on Windows 10. The steps are the followings:

  1. Create a working directory and move into it: mkdir scratch-dev, cd scratch-dev
  2. Clone scratch-blocks: git clone https://github.com/LLK/scratch-blocks.git
  3. Clone closure-library on the same directory as Blockly's official guide of Closure says: git clone https://github.com/google/closure-library.git
  4. cd scratch-blocks
  5. npm install

(I created a new clone of closure-library. Instead, you can make a simlink of NPM's closure-library. See rschamp's comment.)

@jyh129143 Would you tell us how you installed closure-library? Perhaps it's different from my method because your log says that you used a local compiler, whereas mine says I used a remote one.

Environment

  • Windows 10 Home 1803
  • cmd.exe (In fact, I use Anaconda Prompt)
  • Node.js v8.11.3 (NPM 5.6.0)
  • Python 2.7.15 :: Anaconda, Inc.
  • scratch-blocks f5ff602
  • closure-library google/closure-library@31865ca

Even follow your steps to clone a completely new project, and npm installed( we used yarn previously), stll same problem:

> scratch-blocks@0.1.0 prepublish E:\scratch-dev\scratch-blocks
> python build.py && webpack

Traceback (most recent call last):
  File "build.py", line 574, in <module>
    test_proc = subprocess.Popen(test_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  File "C:\Python27\lib\subprocess.py", line 394, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 644, in _execute_child
    startupinfo)
WindowsError: [Error 2]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scratch-blocks@0.1.0 prepublish: `python build.py && webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scratch-blocks@0.1.0 prepublish 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!     C:\Users\Lenovo\AppData\Roaming\npm-cache\_logs\2019-06-04T02_23_28_128Z-debug.log
nekketsuuu commented 5 years ago

@JiangLiruii Yeah I believe this error is reproducible on your system. The problem is that the error cannot be reproduced on my system. So I want to dig in to your settings, especially the diff between you and me :)

[at]here I would appreciate if you could give your environment information if you could reproduce this issue on your system.

JevenM commented 5 years ago

I had the same problem, I don't know why.


D:\Git\scratch-blocks>npm install
npm WARN rollback Rolling back node-pre-gyp@0.12.0 failed (this is probably harmless): EPERM: operation not permitted, lstat 'D:\Git\scratch-blocks\node_modules\fsevents\node_modules'
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> scratch-blocks@0.1.0 prepublish D:\Git\scratch-blocks
> python build.py && webpack

Traceback (most recent call last):
  File "build.py", line 574, in <module>
    test_proc = subprocess.Popen(test_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  File "D:\python2.7.16\lib\subprocess.py", line 394, in __init__
    errread, errwrite)
  File "D:\python2.7.16\lib\subprocess.py", line 644, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scratch-blocks@0.1.0 prepublish: `python build.py && webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scratch-blocks@0.1.0 prepublish 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!     D:\node\nodejs\node_cache\_logs\2019-06-11T06_48_58_343Z-debug.log```
Tereshka commented 5 years ago

The problem is still here:

d:\MyDocs\scratch-blocks-develop\scratch-blocks-develop>npm i
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> scratch-blocks@0.1.0 prepublish d:\MyDocs\scratch-blocks-develop\scratch-blocks-develop
> python build.py && webpack

Traceback (most recent call last):
  File "build.py", line 574, in <module>
    test_proc = subprocess.Popen(test_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  File "C:\Python27\lib\subprocess.py", line 394, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 644, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scratch-blocks@0.1.0 prepublish: `python build.py && webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scratch-blocks@0.1.0 prepublish 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!     C:\Users\Elena\AppData\Roaming\npm-cache\_logs\2019-06-19T01_16_06_802Z-debug.log

2019-06-19T01_16_06_802Z-debug.log

LAST-iMP commented 5 years ago

i have the same problem either

peiyumo commented 5 years ago

As just a side note, my build was succeeded with no patch on Windows 10. The steps are the followings:

  1. Create a working directory and move into it: mkdir scratch-dev, cd scratch-dev
  2. Clone scratch-blocks: git clone https://github.com/LLK/scratch-blocks.git
  3. Clone closure-library on the same directory as Blockly's official guide of Closure says: git clone https://github.com/google/closure-library.git
  4. cd scratch-blocks
  5. npm install

(I created a new clone of closure-library. Instead, you can make a simlink of NPM's closure-library. See rschamp's comment.)

@jyh129143 Would you tell us how you installed closure-library? Perhaps it's different from my method because your log says that you used a local compiler, whereas mine says I used a remote one.

Environment

  • Windows 10 Home 1803
  • cmd.exe (In fact, I use Anaconda Prompt)
  • Node.js v8.11.3 (NPM 5.6.0)
  • Python 2.7.15 :: Anaconda, Inc.
  • scratch-blocks f5ff602
  • closure-library google/closure-library@31865ca

May I know how you link these two projects? I have cloned them as you said, but these two projects don't have any relation. So I could expect that there is no difference with single "scratch-blocks" project. So I still get this error. My computer environment: Win10 Enterprise 1809 Python : 2.7.14 Node:v10.16.3 (npm v6.9.0) error_20190910154842 fileTree_20190910154959

ProfAndreaPollini commented 5 years ago

In order to solve this problem I modified the build.py file as you can see from this diff file.

Hope this helps

diff.zip

gh852195168 commented 4 years ago

有人解决了吗,,,,,

DimuDesigns commented 4 years ago

I was able to build scratch-blocks successfully by modifying build.py to execute google-closure-library via powershell.

Check out my pull request linked below:

2020

caoqiang250 commented 4 years ago

参考 https://blog.csdn.net/weixin_41602509/article/details/103636151 ,修改下build.py文件,问题解决。问题出在命令行太长。

menahem commented 1 year ago

2364