Skip to content

Building Code-server in freebsd error with npm and node path error #529

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

Closed
emanzx opened this issue Apr 18, 2019 · 10 comments
Closed

Building Code-server in freebsd error with npm and node path error #529

emanzx opened this issue Apr 18, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@emanzx
Copy link

emanzx commented Apr 18, 2019

  • code-server version: Github Master
  • OS Version: FreeBSD 11.2

Description

Try to build the code server.

$ node --version
v11.6.0
$ yarn --version
1.12.3
$ npm --version
6.4.1

then:
./scripts/build.sh which halted at :

yarn run v1.12.3
$ ts-node -r tsconfig-paths/register build/tasks.ts build:server:binary
INFO  BUILD:SERVER:BINARY Starting...
INFO  VSCODE:INSTALL Starting...
INFO  VSCODE:INSTALL Executing 'git ["reset","--hard"]' {"options":{"cwd":"/usr/home/system/code-server/lib/vscode"}}
INFO  VSCODE:INSTALL Completed! time=770ms {"time":{"expected":9007199254740991,"ms":1555582202397}}
INFO  BUILD:BOOTSTRAP-FORK Starting...
INFO  BUILD:WEB Starting...
INFO  BUILD:SERVER:BUNDLE Starting...
INFO  BUILD:SERVER:BUNDLE Executing 'npm ["run","build"]' {"options":{"cwd":"/usr/home/system/code-server/packages/server"}}
INFO  BUILD:APP:BROWSER Starting...
INFO  VSCODE:PATCH Starting...
INFO  BUILD:APP:BROWSER Executing 'npm ["run","build"]' {"options":{"cwd":"/usr/home/system/code-server/packages/app/browser"}}
INFO  VSCODE:PATCH Executing 'git ["apply","--unidiff-zero","/usr/home/system/code-server/scripts/vscode.patch"]' {"options":{"cwd":"/usr/home/system/code-server/lib/vscode"}}
INFO  VSCODE:PATCH Completed! time=29ms {"time":{"expected":9007199254740991,"ms":1555582203171}}
INFO  BUILD:BOOTSTRAP-FORK Executing 'npm ["run","build:bootstrap-fork"]' {"options":{"cwd":"/usr/home/system/code-server/packages/vscode"}}
INFO  BUILD:WEB Executing 'npm ["run","build"]' {"options":{"cwd":"/usr/home/system/code-server/packages/web"}}
INFO  BUILD:APP:BROWSER Completed! time=4762ms {"time":{"expected":9007199254740991,"ms":1555582203171}}
INFO  BUILD:SERVER:BUNDLE Completed! time=9376ms {"time":{"expected":9007199254740991,"ms":1555582203168}}
INFO  BUILD:BOOTSTRAP-FORK Completed! time=12902ms {"time":{"expected":9007199254740991,"ms":1555582203167}}
INFO  BUILD:WEB Completed! time=19778ms {"time":{"expected":9007199254740991,"ms":1555582203168}}
INFO  BUILD:SERVER:BINARY:PACKAGE Starting...
INFO  BUILD:SERVER:BINARY:COPY Starting...
INFO  BUILD:SERVER:BINARY:COPY Completed! time=1865ms {"time":{"expected":9007199254740991,"ms":1555582222946}}
INFO  BUILD:SERVER:BINARY:PACKAGE Executing 'npm ["run","build:binary"]' {"options":{"cwd":"/usr/home/system/code-server/packages/server"}}
ERROR BUILD:SERVER:BINARY:PACKAGE failed {"exitCode":1,"stdout":"\n> server@ build:binary /usr/home/system/code-server/packages/server\n> ts-node scripts/nbin.ts\n\n\u001b[1m\u001b[38;2;0;143;191mINFO  \u001b[0mPackaged module\u001b[38;2;140;140;140m {\"module\":\"spdlog\"}\n\u001b[1m\u001b[38;2;0;143;191mINFO  \u001b[0mPackaged module\u001b[38;2;140;140;140m {\"module\":\"node-pty\"}\n\u001b[1m\u001b[38;2;0;143;191mINFO  \u001b[0mPackaged module\u001b[38;2;140;140;140m {\"module\":\"mkdirp\"}\n\u001b[1m\u001b[38;2;0;143;191mINFO  \u001b[0mPackaged module\u001b[38;2;140;140;140m {\"module\":\"bindings\"}\n\u001b[1m\u001b[38;2;0;143;191mINFO  \u001b[0mFetching\u001b[38;2;140;140;140m {\"url\":\"https://nbin.cdr.sh/1.1.2/node-10.15.1-freebsd-x86_64\"}\n","stderr":"npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1555582201821-0.772229819417033/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.\n✔ Wrote 1128 files!\n✔ Wrote 1 file!\nError: Forbidden\n    at e.Binary.<anonymous> (/usr/home/system/code-server/packages/server/node_modules/@coder/nbin/out/api.js:1:43397)\n    at Generator.next (<anonymous>)\n    at s (/usr/home/system/code-server/packages/server/node_modules/@coder/nbin/out/api.js:1:40627)\n    at process.internalTickCallback (internal/process/next_tick.js:77:7)\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! server@ build:binary: `ts-node scripts/nbin.ts`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the server@ build:binary script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /home/system/.npm/_logs/2019-04-18T10_10_26_210Z-debug.log\n"}
ERROR BUILD:SERVER:BINARY:PACKAGE Failed: Failed to package binary: npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1555582201821-0.772229819417033/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
✔ Wrote 1128 files!
✔ Wrote 1 file!
Error: Forbidden
    at e.Binary.<anonymous> (/usr/home/system/code-server/packages/server/node_modules/@coder/nbin/out/api.js:1:43397)
    at Generator.next (<anonymous>)
    at s (/usr/home/system/code-server/packages/server/node_modules/@coder/nbin/out/api.js:1:40627)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server@ build:binary: `ts-node scripts/nbin.ts`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the server@ build:binary 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!     /home/system/.npm/_logs/2019-04-18T10_10_26_210Z-debug.log

ERROR BUILD:SERVER:BINARY:PACKAGE Stack: Error: Failed to package binary: npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1555582201821-0.772229819417033/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
✔ Wrote 1128 files!
✔ Wrote 1 file!
Error: Forbidden
    at e.Binary.<anonymous> (/usr/home/system/code-server/packages/server/node_modules/@coder/nbin/out/api.js:1:43397)
    at Generator.next (<anonymous>)
    at s (/usr/home/system/code-server/packages/server/node_modules/@coder/nbin/out/api.js:1:40627)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server@ build:binary: `ts-node scripts/nbin.ts`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the server@ build:binary 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!     /home/system/.npm/_logs/2019-04-18T10_10_26_210Z-debug.log

    at Object.runner_1.register [as func] (/usr/home/system/code-server/build/tasks.ts:39:9)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
error Command failed with exit code 1.

@emanzx emanzx added the bug Something isn't working label Apr 18, 2019
@nol166
Copy link
Contributor

nol166 commented Apr 18, 2019

It looks like the version of node installed and the one in the temp directory are mismatched. The node binary used for scripts is /tmp/yarn--1555582201821-0.772229819417033/node but npm is using /usr/local/bin/node

Try clearing out the temp directory rm -rf /tmp/yarn*

If that doesn't work I would recommend trying an older version of node, specifically 10.15.1

@sdirkwinkel
Copy link

We can fix the node version mismatch by installing node 10 and using npm config set scripts-prepend-node-path auto
This does not work even with node-10 because nbin tries to download a patched node binary. I'll ask in the nbin repository about what's required to build a patched node version.

$ yarn ts-node ./packages/server/scripts/nbin.ts
yarn run v1.13.0
$ /usr/home/std/code-server/node_modules/.bin/ts-node ./packages/server/scripts/nbin.ts
✔ Wrote 1131 files!
✔ Wrote 1 file!
INFO  Packaged module {"module":"spdlog"}
INFO  Packaged module {"module":"node-pty"}
INFO  Packaged module {"module":"mkdirp"}
INFO  Packaged module {"module":"bindings"}
INFO  Fetching {"url":"https://nbin.cdr.sh/1.1.2/node-10.15.1-freebsd-x86_64"}
Error: Forbidden
    at e.Binary.<anonymous> (/usr/home/std/code-server/packages/server/node_modules/@coder/nbin/out/api.js:1:43397)
    at Generator.next (<anonymous>)
    at s (/usr/home/std/code-server/packages/server/node_modules/@coder/nbin/out/api.js:1:40627)
    at process._tickCallback (internal/process/next_tick.js:68:7)

@sdirkwinkel
Copy link

I've now gotten code-server to work using npm start

The protocol and node-netstat packages require small fixes to load on freebsd

@emanzx
Copy link
Author

emanzx commented Apr 29, 2019

can you share the update. I try all the previous reply method. it seem the error has change a bit and look the same as your error msg.
if code-server can start on freebsd I would be very happy.

@sdirkwinkel
Copy link

If you want to start code-server you should try npm start. That should at least give you an error pointing to the protocol and node-netstat package. To build a binary you'll need to build a node version with patches applied from the nbin repository.
I'll be looking into making a port from these changes.

I've attached a code-server binary if you want to try it.
If you do try it please report back how well it works for you.

you first need to install some dependencies:
pkg install c-ares icu libuv nghttp2
You can then just run the code-server binary
code-server_1.zip

@emanzx
Copy link
Author

emanzx commented Apr 30, 2019

Good works @0xQSL..
I tried your binary but it seem has been compiled with newer freebsd 12. so im getting this error

$ chmod +x code-server
$ ./code-server 
Shared object "libcrypto.so.111" not found, required by "code-server"

@emanzx
Copy link
Author

emanzx commented May 7, 2019

I try to do some dirty hack for node-netstat

The webpack looks running but when browsing to the address.. it seem not loading and only showing blank black page.

[system@dnsvplatform ~/code-server]$ npm start

> @coder/code-server@ start /usr/home/system/code-server
> cd ./packages/server && yarn start

yarn run v1.12.3
warning package.json: No license field
warning ../package.json: No license field
$ node --max-old-space-size=32384 --require ts-node/register --require tsconfig-paths/register src/cli.ts
INFO  code-server development
INFO  Additional documentation: http://github.com/codercom/code-server
INFO  Initializing {"data-dir":"/home/system/.local/share/code-server","extensions-dir":"/home/system/.local/share/code-server/extensions","working-dir":"/usr/home/system/code-server/packages/server","log-dir":"/home/system/.cache/code-server/logs/20190507080600107"}
Happy[ts]: Version: 5.0.1. Threads: 7
INFO  Starting webserver... {"host":"0.0.0.0","port":8443}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md
INFO   
INFO  Password: 7176e227f92898e28bd3f8ca
INFO   
INFO  Started (click the link below to open):
INFO  http://localhost:8443/
INFO   
INFO  Starting shared process [1/5]...
Happy[ts]: All set; signaling webpack to proceed.
INFO  Connected to shared process
INFO  webpack {"message":"wait until bundle finished: /"}
webpack built 9ed75e5557726a13f175 in 13712ms
WARN  webpack {"message":"\nWARNING in ./lib/vscode/src/vs/platform/environment/node/environmentService.ts 71:78-85\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/platform/environment/node/environmentService.ts 178:79-86\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/cli/node/cli.contribution.ts 36:50-57\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/performance/electron-browser/perfviewEditor.ts 246:43-50\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/externalTerminal/electron-browser/externalTerminalService.ts 114:64-71\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/base/node/processes.ts 56:53-60\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/node_modules/getmac/index.js 3:63-70\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/search/node/searchService.ts 420:76-83\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts 56:88-95\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts 63:96-103\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts 351:100-107\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts 120:98-105\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/debug/node/debugger.ts 247:76-83\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/files/node/watcher/unix/watcherService.ts 24:72-79\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/files/node/watcher/nsfw/watcherService.ts 23:72-79\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/debug/node/terminals.ts 131:64-71\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/files/node/watcher/win32/csharpWatcherService.ts 31:62-69\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/node_modules/vscode-textmate/release/main.js 14:15-27\nCritical dependency: the request of a dependency is an expression\n\nWARNING in ./lib/vscode/src/vs/editor/common/services/editorSimpleWorker.ts 462:16-472:26\nCritical dependency: the request of a dependency is an expression"}
INFO  webpack {"message":"Compiled with warnings."}

upon further checking.. I found out the browser failed to connect to the websocket.
anything I should look into.
thanks

@sdirkwinkel
Copy link

looks like this for me:
I added --no-auth to the start command but I don't think that matters

npm start

> @coder/code-server@ start /usr/home/std/code-server
> cd ./packages/server && yarn start --no-auth

yarn run v1.13.0
warning package.json: No license field
warning ../package.json: No license field
$ node --max-old-space-size=32384 --require ts-node/register --require tsconfig-paths/register src/cli.ts --no-auth
INFO  code-server development
INFO  Additional documentation: http://github.com/codercom/code-server
INFO  Initializing {"data-dir":"/home/std/.local/share/code-server","extensions-dir":"/home/std/.local/share/code-server/extensions","working-dir":"/usr/home/std/code-server/packages/server","log-dir":"/home/std/.cache/code-server/logs/20190507101507258"}                                                         
Happy[ts]: Version: 5.0.1. Threads: 13                                                                                                                      
INFO  Starting webserver... {"host":"0.0.0.0","port":8443}                                                                                                  
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md
WARN  Launched without authentication.
INFO   
INFO  Started (click the link below to open):
INFO  https://localhost:8443/
INFO   
INFO  Starting shared process [1/5]...
Happy[ts]: All set; signaling webpack to proceed.
INFO  Connected to shared process
webpack built 1d91739692bbaed85735 in 22149ms
WARN  webpack {"message":"\nWARNING in ./lib/vscode/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts 56:88-95\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/platform/environment/node/environmentService.ts 71:78-85\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/debug/node/debugger.ts 259:72-79\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/cli/node/cli.contribution.ts 30:46-53\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/files/node/watcher/win32/csharpWatcherService.ts 31:62-69\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/performance/electron-browser/perfviewEditor.ts 243:39-46\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/node_modules/getmac/index.js 3:63-70\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/externalTerminal/electron-browser/externalTerminalService.ts 113:60-67\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/base/node/processes.ts 54:49-56\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/platform/environment/node/environmentService.ts 178:79-86\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts 63:96-103\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/extensions/electron-browser/cachedExtensionScanner.ts 351:100-107\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts 143:94-101\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/files/node/watcher/nsfw/watcherService.ts 23:72-79\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/files/node/watcher/unix/watcherService.ts 24:72-79\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/services/search/node/searchService.ts 420:76-83\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/workbench/contrib/debug/node/terminals.ts 124:60-67\nCritical dependency: require function is used in a way in which dependencies cannot be statically extracted\n\nWARNING in ./lib/vscode/src/vs/editor/common/services/editorSimpleWorker.ts 462:16-472:26\nCritical dependency: the request of a dependency is an expression\n\nWARNING in ./lib/vscode/node_modules/vscode-textmate/release/main.js 14:15-27\nCritical dependency: the request of a dependency is an expression"}
INFO  webpack {"message":"Compiled with warnings."}
INFO  WebSocket opened / {"client":1,"ip":"192.168.122.1"}
INFO  WebSocket closed / {"client":1,"code":1001}
INFO  Wrote resource {"path":"//home/std/.local/share/code-server/globalStorage/state.json","content-length":69498}
INFO  Wrote resource {"path":"//home/std/.local/share/code-server/User/workspaceStorage/73b8f04e2188323824c4caeeb5fa76b7/state.json","content-length":3278}
INFO  WebSocket opened / {"client":2,"ip":"192.168.122.1"}

@sdirkwinkel
Copy link

I also won't invest any more work into this until it's clear whether code-server will be continued [1] or MS will open source/ compile for freebsd their remote stuff [2]

[1] #655
[2] https://code.visualstudio.com/docs/remote/faq#_why-arent-the-remote-development-extensions-or-their-components-open-source

@nhooyr
Copy link
Contributor

nhooyr commented Jan 28, 2020

This is an nbin issue. See coder/nbin#42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants