Giter VIP home page Giter VIP logo

vscode-remote-try-node's Introduction

Try Out Development Containers: Node.js

Open in Dev Containers

A development container is a running container with a well-defined tool/runtime stack and its prerequisites. You can try out development containers with GitHub Codespaces or Visual Studio Code Dev Containers.

This is a sample project that lets you try out either option in a few easy steps. We have a variety of other vscode-remote-try-* sample projects, too.

Note: If you already have a Codespace or dev container, you can jump to the Things to try section.

Setting up the development container

GitHub Codespaces

Follow these steps to open this sample in a Codespace:

  1. Click the Code drop-down menu.
  2. Click on the Codespaces tab.
  3. Click Create codespace on main .

For more info, check out the GitHub documentation.

VS Code Dev Containers

If you already have VS Code and Docker installed, you can click the badge above or here to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.

Follow these steps to open this sample in a container using the VS Code Dev Containers extension:

  1. If this is your first time using a development container, please ensure your system meets the pre-reqs (i.e. have Docker installed) in the getting started steps.

  2. To use this repository, you can either open the repository in an isolated Docker volume:

    • Press F1 and select the Dev Containers: Try a Sample... command.
    • Choose the "Node" sample, wait for the container to start, and try things out!

      Note: Under the hood, this will use the Dev Containers: Clone Repository in Container Volume... command to clone the source code in a Docker volume instead of the local filesystem. Volumes are the preferred mechanism for persisting container data.

    Or open a locally cloned copy of the code:

    • Clone this repository to your local filesystem.
    • Press F1 and select the Dev Containers: Open Folder in Container... command.
    • Select the cloned copy of this folder, wait for the container to start, and try things out!

Things to try

Once you have this sample opened, you'll be able to work with it like you would locally.

Some things to try:

  1. Edit:

    • Open server.js
    • Try adding some code and check out the language features.
    • Make a spelling mistake and notice it is detected. The Code Spell Checker extension was automatically installed because it is referenced in .devcontainer/devcontainer.json.
    • Also notice that eslint and the ESLint extension are installed. Tools are installed in the mcr.microsoft.com/devcontainers/javascript-node image and Dev Container settings and metadata are automatically picked up from image labels.
  2. Terminal: Press Ctrl+Shift+` and type uname and other Linux commands from the terminal window.

  3. Build, Run, and Debug:

    • Open server.js
    • Add a breakpoint (e.g. on line 20).
    • Press F5 to launch the app in the container.
    • Once the breakpoint is hit, try hovering over variables, examining locals, and more.
    • Continue (F5). You can connect to the server in the container by either:
      • Clicking on Open in Browser in the notification telling you: Your service running on port 3000 is available.
      • Clicking the globe icon in the 'Ports' view. The 'Ports' view gives you an organized table of your forwarded ports, and you can access it with the command Ports: Focus on Ports View.
    • Notice port 3000 in the 'Ports' view is labeled "Hello Remote World." In devcontainer.json, you can set "portsAttributes", such as a label for your forwarded ports and the action to be taken when the port is autoforwarded.
      • If we didn't know the port was 3000, we could've used a regex instead of "3000" in the "portsAttributes", such as ".+/server.js".

    Note: In Dev Containers, you can access your app at http://localhost:3000 in a local browser. But in a browser-based Codespace, you must click the link from the notification or the Ports view so that the service handles port forwarding in the browser and generates the correct URL.

  4. Rebuild or update your container

    You may want to make changes to your container, such as installing a different version of a software or forwarding a new port. You'll rebuild your container for your changes to take effect.

    Open browser automatically: As an example change, let's update the portsAttributes in the .devcontainer/devcontainer.json file to open a browser when our port is automatically forwarded.

    • Open the .devcontainer/devcontainer.json file.
    • Modify the "onAutoForward" attribute in your portsAttributes from "notify" to "openBrowser".
    • Press F1 and select the Dev Containers: Rebuild Container or Codespaces: Rebuild Container command so the modifications are picked up.
  5. Install the GitHub CLI using a Dev Container Feature:

    • Press F1 and select the Dev Containers: Configure Container Features... or Codespaces: Configure Container Features... command.
    • Type "github" in the text box at the top.
    • Check the check box next to "GitHub CLI" (published by devcontainers)
    • Click OK
    • Press F1 and select the Dev Containers: Rebuild Container or Codespaces: Rebuild Container command so the modifications are picked up.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

Copyright © Microsoft Corporation All rights reserved.
Licensed under the MIT License. See LICENSE in the project root for license information.

vscode-remote-try-node's People

Contributors

2percentsilk avatar alexr00 avatar andrebrowne avatar andyli avatar bamurtaugh avatar chuxel avatar dependabot[bot] avatar egamma avatar forana avatar kieferrm avatar liona24 avatar magicshoebox avatar microsoftopensource avatar msftgits avatar samruddhikhandale avatar sana-ajani avatar sinedied avatar tyriar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-remote-try-node's Issues

Error on Raspberry Pi 4 Ubuntu Desktop 21.04 arm64

Template does not work on my Raspberry Pi 4 8GB on Ubuntu Desktop 21.04 arm64.
Both VS Code and Docker run on the same Raspberry. I'm using Remote - Containers extension.
There is info on line 3362:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Full log from VS Code attached:
remoteContainers-2021-06-01T16-24-26.100Z.log

0888881893 0888999999

Tasks

Tasks

How to use these devcontainer file without loosing docker ?

Hi @Chuxel

I started using the .devcontainer settings from this repos after reading your comment here https://github.community/t/not-able-to-install-yarn-and-angular-cli-and-create-codespace-container/159239/3

I later found that I am not able to do use docker in container. Today I remove the .devcontainer and build again now I am able to use docker.

I am only looking for install cli and do npm install after the container create. I don't want to use .devcontainer file since it will not provide me docker but I want to apply postcreatecommand. Any help with that!

for example look at this commit https://github.com/yegasi/yegasi.github.io/commit/6b4762399f89a572e047df4cc39c66419fe77c7b I am only looking for applying the postcreatecommand.

Solidity

pragma solidity ^0.5.9;

/**
@title ERC-1155 Multi Token Standard
@dev See https://eips.ethereum.org/EIPS/eip-1155
Note: The ERC-165 identifier for this interface is 0xd9b67a26.
/
interface ERC1155 /
is ERC165 / {
/
*
@dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The _operator argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
The _from argument MUST be the address of the holder whose balance is decreased.
The _to argument MUST be the address of the recipient whose balance is increased.
The _id argument MUST be the token type being transferred.
The _value argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the _from argument MUST be set to 0x0 (i.e. zero address).
When burning/destroying tokens, the _to argument MUST be set to 0x0 (i.e. zero address).
*/
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);

/**
    @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).      
    The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
    The `_from` argument MUST be the address of the holder whose balance is decreased.
    The `_to` argument MUST be the address of the recipient whose balance is increased.
    The `_ids` argument MUST be the list of tokens being transferred.
    The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
    When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
    When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).                
*/
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);

/**
    @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absence of an event assumes disabled).        
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

/**
    @dev MUST emit when the URI is updated for a token ID.
    URIs are defined in RFC 3986.
    The URI MUST point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
*/
event URI(string _value, uint256 indexed _id);

/**
    @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
    @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
    MUST revert if `_to` is the zero address.
    MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
    MUST revert on any other error.
    MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
    After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).        
    @param _from    Source address
    @param _to      Target address
    @param _id      ID of the token type
    @param _value   Transfer amount
    @param _data    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;

/**
    @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
    @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
    MUST revert if `_to` is the zero address.
    MUST revert if length of `_ids` is not the same as length of `_values`.
    MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
    MUST revert on any other error.        
    MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
    Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
    After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).                      
    @param _from    Source address
    @param _to      Target address
    @param _ids     IDs of each token type (order and length must match _values array)
    @param _values  Transfer amounts per token type (order and length must match _ids array)
    @param _data    Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;

/**
    @notice Get the balance of an account's tokens.
    @param _owner  The address of the token holder
    @param _id     ID of the token
    @return        The _owner's balance of the token type requested
 */
function balanceOf(address _owner, uint256 _id) external view returns (uint256);

/**
    @notice Get the balance of multiple account/token pairs
    @param _owners The addresses of the token holders
    @param _ids    ID of the tokens
    @return        The _owner's balance of the token types requested (i.e. balance for each (owner, id) pair)
 */
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);

/**
    @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
    @dev MUST emit the ApprovalForAll event on success.
    @param _operator  Address to add to the set of authorized operators
    @param _approved  True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;

/**
    @notice Queries the approval status of an operator for a given owner.
    @param _owner     The owner of the tokens
    @param _operator  Address of authorized operator
    @return           True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool);

}

Solidity coinbase

pragma solidity ^0.5.9;

/**
@title ERC-1155 Multi Token Standard
@dev See https://eips.ethereum.org/EIPS/eip-1155
Note: The ERC-165 identifier for this interface is 0xd9b67a26.
/
interface ERC1155 /
is ERC165 / {
/
*
@dev Either TransferSingle or TransferBatch MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The _operator argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
The _from argument MUST be the address of the holder whose balance is decreased.
The _to argument MUST be the address of the recipient whose balance is increased.
The _id argument MUST be the token type being transferred.
The _value argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the _from argument MUST be set to 0x0 (i.e. zero address).
When burning/destroying tokens, the _to argument MUST be set to 0x0 (i.e. zero address).
*/
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);

/**
    @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).      
    The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
    The `_from` argument MUST be the address of the holder whose balance is decreased.
    The `_to` argument MUST be the address of the recipient whose balance is increased.
    The `_ids` argument MUST be the list of tokens being transferred.
    The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
    When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
    When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).                
*/
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);

/**
    @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absence of an event assumes disabled).        
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

/**
    @dev MUST emit when the URI is updated for a token ID.
    URIs are defined in RFC 3986.
    The URI MUST point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
*/
event URI(string _value, uint256 indexed _id);

/**
    @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
    @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
    MUST revert if `_to` is the zero address.
    MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
    MUST revert on any other error.
    MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
    After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).        
    @param _from    Source address
    @param _to      Target address
    @param _id      ID of the token type
    @param _value   Transfer amount
    @param _data    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;

/**
    @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
    @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
    MUST revert if `_to` is the zero address.
    MUST revert if length of `_ids` is not the same as length of `_values`.
    MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
    MUST revert on any other error.        
    MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
    Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
    After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).                      
    @param _from    Source address
    @param _to      Target address
    @param _ids     IDs of each token type (order and length must match _values array)
    @param _values  Transfer amounts per token type (order and length must match _ids array)
    @param _data    Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;

/**
    @notice Get the balance of an account's tokens.
    @param _owner  The address of the token holder
    @param _id     ID of the token
    @return        The _owner's balance of the token type requested
 */
function balanceOf(address _owner, uint256 _id) external view returns (uint256);

/**
    @notice Get the balance of multiple account/token pairs
    @param _owners The addresses of the token holders
    @param _ids    ID of the tokens
    @return        The _owner's balance of the token types requested (i.e. balance for each (owner, id) pair)
 */
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);

/**
    @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
    @dev MUST emit the ApprovalForAll event on success.
    @param _operator  Address to add to the set of authorized operators
    @param _approved  True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;

/**
    @notice Queries the approval status of an operator for a given owner.
    @param _owner     The owner of the tokens
    @param _operator  Address of authorized operator
    @return           True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool);

}pragma solidity ^0.5.9;

/**
Note: The ERC-165 identifier for this interface is 0x4e2312e0.
/
interface ERC1155TokenReceiver {
/
*
@notice Handle the receipt of a single ERC1155 token type.
@dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a safeTransferFrom after the balance has been updated.
This function MUST return bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) (i.e. 0xf23a6e61) if it accepts the transfer.
This function MUST revert if it rejects the transfer.
Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.
@param _operator The address which initiated the transfer (i.e. msg.sender)
@param _from The address which previously owned the token
@param _id The ID of the token being transferred
@param _value The amount of tokens being transferred
@param _data Additional data with no specified format
@return bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))
*/
function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _value, bytes calldata _data) external returns(bytes4);

/**
    @notice Handle the receipt of multiple ERC1155 token types.
    @dev An ERC1155-compliant smart contract MUST call this function on the token recipient contract, at the end of a `safeBatchTransferFrom` after the balances have been updated.        
    This function MUST return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81) if it accepts the transfer(s).
    This function MUST revert if it rejects the transfer(s).
    Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.
    @param _operator  The address which initiated the batch transfer (i.e. msg.sender)
    @param _from      The address which previously owned the token
    @param _ids       An array containing ids of each token being transferred (order and length must match _values array)
    @param _values    An array containing amounts of each token being transferred (order and length must match _ids array)
    @param _data      Additional data with no specified format
    @return           `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
*/
function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external returns(bytes4);       

fix(readme/vs-code-dev-containers): EACCES: permission denied, mkdir '/workspaces/vscode-remote-try-node/node_modules'

I followed the steps in this section of the readme (clone and then hit 'reopen in container') but it crashes because the bind mount files are owned by root even though I'm logged in as myself (non-root user) when I perform the steps from here: https://github.com/microsoft/vscode-remote-try-node#vs-code-dev-containers

This entire problem also happens on a different dev container of mine which is nothing but an unmodified ubuntu-2204 image so it does not seem to be specific to the image that is being used.

Logs

The crash itself due to the file-system permissions misconfiguration:

Running the postCreateCommand from devcontainer.json...

[68321 ms] Start: Run in container: /bin/sh -c yarn install
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
error Could not write file "/workspaces/vscode-remote-try-node/yarn-error.log": "EACCES: permission denied, open '/workspaces/vscode-remote-try-node/yarn-error.log'"
error An unexpected error occurred: "EACCES: permission denied, mkdir '/workspaces/vscode-remote-try-node/node_modules'".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[74388 ms] postCreateCommand failed with exit code 1. Skipping any further user-provided commands.
Done. Press any key to close the terminal.

In-container user information

node ➜ /workspaces/vscode-remote-try-node $ id
uid=1000(node) gid=1000(node) groups=1000(node),998(nvm),999(npm)

Host machine user information

$ id
uid=1000(peter) gid=1000(peter) groups=1000(peter),4(adm),999(docker),24(cdrom),27(sudo),30(dip),46(plugdev),109(kvm),122(lpadmin),135(lxd),136(sambashare)

Container image build log:

2023-04-24-Dev_Containers_0.288.1_in_VS_Code_1.77.3_704ed70d4fd1c6bd6342c436f1ede30d1cff4710.log

The OS version

$ printf "$(uname -srm)\n$(cat /etc/os-release)\n"
Linux 5.19.0-40-generic x86_64
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Performed the instructions to try this example but got Error: Cannot find module 'express'

I performed the instructions to try this example but got Error: Cannot find module 'express'

/usr/bin/node --inspect-brk=35421 server.js
Debugger listening on ws://127.0.0.1:35421/0330b091-2d91-47c2-be20-d845f67a1ba9
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
Error: Cannot find module 'express'
Require stack:
- /home/nickw/vscode-remote-try-node/server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/home/nickw/vscode-remote-try-node/server.js:8:17)
    at Module._compile (internal/modules/cjs/loader.js:1130:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
  • VSCode Version: 1.45.1 (system setup)
    Commit: 5763d90
    Date: 2020-05-14T08:27:35.169Z
    Electron: 7.2.4
    Chrome: 78.0.3904.130
    Node.js: 12.8.1
    V8: 7.8.279.23-electron.0

  • OS: Windows_NT x64 10.0.18363
    OS Version:
    Windows 10 Pro
    Version 1909
    Installed on 21/08/2019
    OS build 18363.836

Command to run server required

Just a quick note.
The devcontainer.json postCreateCommand should be:

"postCreateCommand": "yarn install && node server.js"

To start the server (?) . Or have I missed something .

Thanks

Problems trying to run using Podman with Windows 11

SO: Windows 11 Version 21H2 (OS Build 22000.739)
podman.exe version 4.1.1
VSCode: Version: 1.68.1 (user setup)
WSL Kernel version: 5.10.102.1

I got this error trying to run remote-development (vscode-remote-try-node) on Windows using podman
Below the links I had use to set up:
https://www.redhat.com/sysadmin/run-podman-windows
https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
https://blog.lifeishao.com/2021/12/30/replacing-docker-with-podman-for-your-vscode-devcontainers/

And the error I got:
[42 ms] Remote-Containers 0.238.2 in VS Code 1.68.1 (30d9c6cd9483b2cc586687151bcbcd635f373630).
[41 ms] Start: Resolving Remote
[45 ms] Start: Run: wsl -l -v
[105 ms] Start: Run: wsl -d podman-machine-default -e /bin/sh -c echo ~
[227 ms] Start: Run: wsl -d podman-machine-default -e /bin/sh -c cd '/root' && /bin/sh
[236 ms] Start: Run in host: id -un
[297 ms] root
[297 ms]
[298 ms] Start: Run in host: cat /etc/passwd
[300 ms] Start: Run in host: echo ~
[301 ms] /root
[301 ms]
[302 ms] Start: Run in host: test -x '/root/.vscode-remote-containers/bin/30d9c6cd9483b2cc586687151bcbcd635f373630/node'
[303 ms]
[303 ms]
[304 ms] Start: Run in host: test -f '/root/.vscode-remote-containers/dist/vscode-remote-containers-server-0.238.2.js'
[305 ms]
[305 ms]
[310 ms] userEnvProbe: loginInteractiveShell (default)
[310 ms] userEnvProbe shell: /bin/bash
[2316 ms] Start: Run in Host: /bin/sh
[2324 ms] Start: Run in container: for pid in cd /proc && ls -d [0-9]*; do { echo $pid ; readlink /proc/$pid/cwd ; readlink /proc/$pid/ns/mnt ; cat /proc/$pid/stat | tr "
[4368 ms] userEnvProbe is taking longer than 2 seconds. Process not found.
[10326 ms] userEnvProbe is taking longer than 10 seconds. Avoid waiting for user input in your shell's startup scripts. Continuing.
[10347 ms] Start: Check Docker is running
[10347 ms] Start: Run in Host: podman version --format {{.Server.APIVersion}}
[10560 ms] Server API version: 4.1.1
[10565 ms] Start: Run in Host: podman volume ls -q
[10729 ms] Start: Run in Host: podman volume create --label vsch.local.repository=https://github.com/Microsoft/vscode-remote-try-node --label vsch.local.repository.unique=true vscode-remote-try-node-6789fd329eb29bc56aab44eb27506206
[11077 ms] Start: Run in Host: tar --no-same-owner -x -f -
[11185 ms] Start: Run in Host: podman build -f /tmp/vsch/bootstrap-image/0.238.2/bootstrap.Dockerfile -t vsc-volume-bootstrap /tmp/vsch/bootstrap-image/0.238.2
STEP 1/4: FROM mcr.microsoft.com/vscode/devcontainers/base:0-alpine-3.14
Trying to pull mcr.microsoft.com/vscode/devcontainers/base:0-alpine-3.14...
Getting image source signatures
Copying blob 93dce5d3774d done
Copying blob 8663204ce13b done
Copying blob 79f0fdc0e058 done
Copying config f4fb89e582 done
Writing manifest to image destination
Storing signatures
STEP 2/4: RUN apk add --no-cache nodejs npm make g++ docker-cli docker-compose ;
error running container: error from /usr/bin/crun creating container for [/bin/sh -c apk add --no-cache nodejs npm make g++ docker-cli docker-compose ;]: creating cgroup directory /sys/fs/cgroup/systemd/buildah-buildah650293479: No such file or directory
: exit status 1
ERRO[0008] did not get container create message from subprocess: EOF
Error: error building at STEP "RUN apk add --no-cache nodejs npm make g++ docker-cli docker-compose ;": error while running runtime: exit status 1
[19404 ms] Command failed: podman build -f /tmp/vsch/bootstrap-image/0.238.2/bootstrap.Dockerfile -t vsc-volume-bootstrap /tmp/vsch/bootstrap-image/0.238.2
[19405 ms] Exit code 1

Any thoughts!
Thanks in advance

BuiThiNhuQuynh.10dh_cntt2

//1050080073
// giai pt bac nhat
package javabt1;
import java.util.Scanner;
public class Javabt1 {
public static void main(String[] args) {
float a, b, x;
Scanner sc = new Scanner (System.in);
System.out.println("Moi nhap a: ");
a = sc.nextInt();
System.out.println("Moi nhap b: ");
b = sc.nextInt();
if (a==0){
if(b==0){
System.out.println("Phuong trinh vo so nghiem");
}
else{
System.out.println("Phuong trinh vo nghiem");
}
}
else{
x = -b/a;
System.out.println("Phuong trinh co nghiem x ="+x);
}
}
}
// giai phuong trinh bac 2
package javabt1;
import java.util.Scanner;

/**
*

  • @author nhu quynh
    /
    public class javabt2
    {
    public static void main(String[] args)
    {
    double a, b, c, x1, x2, delta;
    Scanner sc = new Scanner (System.in);
    System.out.println("Moi nhap a: ");
    a = sc.nextDouble();
    System.out.println("Moi nhap b: ");
    b = sc.nextDouble();
    System.out.println("Moi nhap c: ");
    c = sc.nextDouble();
    if (a==0)
    {
    if(b==0)
    {
    if(c==0)
    {
    System.out.println("Phuong trinh vo so nghiem");
    }
    else
    {
    System.out.println("Phuong trinh vo nghiem");
    }
    }
    else
    {
    x1 = -c/b;
    System.out.printf("Phuong trinh co nghiem x =%.2f ",x1);
    }
    }
    else
    {
    delta = b
    b - 4ac;
    if (delta < 0)
    {
    System.out.println("Phuong trinh vo nghiem");
    }
    else if (delta == 0)
    {
    x1 = -b/(2a);
    System.out.printf("Phuong trinh co nghiem kep x1 = %.2f", x1);
    }
    else
    {
    x1 = (-b+Math.sqrt(delta))/(2
    a);
    x2 = (-b-Math.sqrt(delta))/(2*a);
    System.out.println("Nghiem thu nhat x1 = " + x1);
    System.out.println("Nghiem thu nhat x2 = " + x2);
    }
    }
    }
    }
    //tinh tien dien
    package javabt1;
    import java.util.Scanner;

/**
*

  • @author nhu quynh
    /
    public class bt3 {
    public static void main(String[] args)
    {
    int x, y;
    Scanner sc = new Scanner(System.in);
    System.out.println("Nhap so dien: ");
    x = sc.nextInt();
    if (x < 50){
    y = x * 1000;
    }else{
    y = 50
    1000 + (x - 50) * 1200;
    }
    System.out.println("Tien dien la: "+ y);
    }
    }
    // tinh giai thua
    package javabt1;

import java.util.Scanner;
/**
*

  • @author nhu quynh
    */
    public class tinhgiaithua {
    public static void main(String[] args) {
    int n;
    Scanner sc = new Scanner (System.in);
    do{
    System.out.println("Nhap vao so nguyen n: ");
    n = sc.nextInt();
    }while (n<0);
    long giaiThua = 1;
    for(int i = 1; i<=n; i++){
    giaiThua = giaiThua * i;
    }
    System.out.println(n + "! = " + giaiThua);
    }
    }
    //tao menu
    package javabt1;
    import java.util.Scanner;

public class Menu {
public static void main(String[] args) {
int numBer;
do{
Scanner sc = new Scanner (System.in);
System.out.println("+------------------------+");
System.out.println("1. Giai Phuong Trinh Bac 1.");
System.out.println("2. Giai Phuong Trinh Bac 2 ");
System.out.println("3. Tinh Tien Dien.");
System.out.println("4. Ket Thuc.");
System.out.println("+------------------------+");
System.out.println("Chon Chuc Nang: ");
numBer = sc.nextInt();
}while (numBer < 1 || numBer > 4);
switch (numBer){
case 1:
System.out.println("Giai Phuong Trinh Bac 1.");
giaiPTB1();
break;
case 2:
System.out.println("Giai Phuong Trinh Bac 2.");
giaiPTB2();
break;
case 3:
System.out.println("Tinh Tien Dien.");
tinhTienDien();
break;
case 4:
System.out.println("Ket Thuc.");
break;
}
}

public static void javabt1() {
    float a, b, x;
    Scanner sc = new Scanner (System.in);
    System.out.println("Moi nhap a: ");
    a = sc.nextInt();
    System.out.println("Moi nhap b: ");
    b = sc.nextInt();
    if (a==0){
        if(b==0){
            System.out.println("Phuong trinh vo so nghiem");
        }else{
            System.out.println("Phuong trinh vo nghiem");
        }
    }else{
            x = -b/a;
            System.out.println("Phuong trinh co nghiem x ="+x);
    }
}

public static void javabt2(){
    double  a, b, c, x1, x2, delta;
    Scanner sc = new Scanner (System.in);
    System.out.println("Moi nhap a: ");
    a = sc.nextDouble();
    System.out.println("Moi nhap b: ");
    b = sc.nextDouble();
    System.out.println("Moi nhap c: ");
    c = sc.nextDouble();
    if (a==0){
        if(b==0){
            if(c==0){
            System.out.println("Phuong trinh vo so nghiem");
            }
            else{
            System.out.println("Phuong trinh vo nghiem");
            }
        }
        else{
        x1 = -c/b;
        System.out.printf("Phuong trinh co nghiem x =%.2f ",x1);
        }   
    }
    else{
        delta = b*b - 4*a*c;
        if (delta < 0){
            System.out.println("Phuong trinh vo nghiem");
        }
        else if (delta == 0){
            x1 = -b/(2*a);
            System.out.printf("Phuong trinh co nghiem kep x1 = %.2f", x1);
        }
        else{
            x1 = (-b+Math.sqrt(delta))/(2*a);
            x2 = (-b-Math.sqrt(delta))/(2*a);
            System.out.println("Nghiem thu nhat x1 = " + x1);
            System.out.println("Nghiem thu nhat x2 = " + x2);
        }
    }      
}

public static void bt3(){
    int x, y;
    Scanner sc = new Scanner(System.in);
    System.out.println("Nhap so dien: ");
    soDien = sc.nextInt();
    if (x < 50){
        y = x * 1000;
    }else{
        y = 50*1000 + (x - 50) * 1200;
    }
    System.out.println("Tien dien la: "+ y);
}

}

Complete example for "Improving container disk performance"

I tried out your example on "Improving container disk performance" to improve the npm install process by using a named volume. Unfortunately I'm not able to get it to work it is always mounting the local folder. Can you ad a full example of the Dockerfile and the devcontainer.json?

Cache package manager for speed up downloading node_modules

Hey there!

I would some way to share package manager cache between Host (Windows) and a NodeJS dev container.

I tried using pnpm but fails because is not possible to link packages in node_modules in different disks.
Any opinion about yarn ou npm maybe? I think it can speed up the process for downloading node_modules and save disk space as well.

How to edit code and development flow

I am very confused.

I followed the instructions to open folder in container.
when vs opens in container, it does not open the folder in the container where the code is.
editing is possible but I need to go back to the host to restart the container to see changes
a volume is created bu it seems it is not being used as editing the file in vscode, leaves the file in the volume unchanged.

What am I missing?

Angular debugging experience is not good, Any help ?

I am not able to debug the angular code like I can do from local install. Am I missing something here.

I first tried on windows and it's showing me too many symbolic links so I test it on ubuntu. On Ubuntu I create a new project and put npm install -g @angular/cli in postcreatedcommand and I am ready to use angular in container.

I am able to do use it properly for coding. Now today I debug it by putting debugger in code and see code in firefox dev tool (I do use chrome and debuggin component to debug code).

I am not able to see anything. the tab is stuck on debugging but nothing came on tool like we does in chrome for a angular project.

Do we need to open some other port, if it's required for proper angular debugging or something else is required. The coding part is going good. I just feel missing debugging here.

Thanks for this repos. This help me to move development to container.

Success Build, Failed Run Images (SyntaxError: Unexpected end of JSON input)

Hi, i try to using remote-containers and try vscode-remote-try-node python. and it failed. i can't figure out what happen here. its succes building image, but failed when running the image.

i'm using ubuntu 18.04.

[2021-06-14T09:15:13.534Z] Remote-Containers 0.183.0 in VS Code 1.57.0 (b4c1bd0a9b03c749ea011b06c6d2676c8091a70c).
[2021-06-14T09:15:13.534Z] Start: Resolving Remote
[2021-06-14T09:15:13.540Z] Setting up container for folder or workspace: path/to/here/data_structure_python
[2021-06-14T09:15:13.543Z] Start: Check Docker is running
[2021-06-14T09:15:13.543Z] Start: Run: docker version --format {{.Server.APIVersion}}
[2021-06-14T09:15:13.649Z] Stop (106 ms): Run: docker version --format {{.Server.APIVersion}}
[2021-06-14T09:15:13.649Z] Server API version: 
[2021-06-14T09:15:13.649Z] Stop (106 ms): Check Docker is running
[2021-06-14T09:15:13.656Z] Start: Run: git rev-parse --show-cdup
[2021-06-14T09:15:13.660Z] Stop (4 ms): Run: git rev-parse --show-cdup
[2021-06-14T09:15:13.662Z] Start: Run: docker ps -q -a --filter label=vsch.local.folder=path/to/here/data_structure_python --filter label=vsch.quality=stable
[2021-06-14T09:15:13.736Z] Stop (74 ms): Run: docker ps -q -a --filter label=vsch.local.folder=path/to/here/data_structure_python --filter label=vsch.quality=stable
[2021-06-14T09:15:13.738Z] Start: Run: docker build -f path/to/here/data_structure_python/.devcontainer/Dockerfile -t vsc-data_structure_python-ade5668d1463d7719d126aba2697d2b6 --build-arg VARIANT=3.9 --build-arg INSTALL_NODE=false --build-arg NODE_VERSION=lts/* path/to/here/data_structure_python
[2021-06-14T09:15:13.852Z] Sending build context to Docker daemon  557.1kB
[2021-06-14T09:15:13.853Z] Sending build context to Docker daemon  714.2kB

[2021-06-14T09:15:13.857Z] Step 1/5 : ARG VARIANT="3.9"
Step 2/5 : FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
[2021-06-14T09:15:13.857Z]  ---> b9043162eac5
Step 3/5 : ARG INSTALL_NODE="true"
[2021-06-14T09:15:13.857Z]  ---> Using cache
 ---> c263cbc3aa4b
Step 4/5 : ARG NODE_VERSION="lts/*"
[2021-06-14T09:15:13.858Z]  ---> Using cache
 ---> 033097ed0e1c
Step 5/5 : RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
[2021-06-14T09:15:13.858Z]  ---> Using cache
 ---> e446c2256cc6
[2021-06-14T09:15:13.859Z] Successfully built e446c2256cc6
[2021-06-14T09:15:13.860Z] Successfully tagged vsc-data_structure_python-ade5668d1463d7719d126aba2697d2b6:latest
[2021-06-14T09:15:13.864Z] Stop (126 ms): Run: docker build -f path/to/here/data_structure_python/.devcontainer/Dockerfile -t vsc-data_structure_python-ade5668d1463d7719d126aba2697d2b6 --build-arg VARIANT=3.9 --build-arg INSTALL_NODE=false --build-arg NODE_VERSION=lts/* path/to/here/data_structure_python
[2021-06-14T09:15:13.865Z] Start: Run: docker inspect --type image vsc-data_structure_python-ade5668d1463d7719d126aba2697d2b6
[2021-06-14T09:15:13.936Z] Stop (71 ms): Run: docker inspect --type image vsc-data_structure_python-ade5668d1463d7719d126aba2697d2b6
[2021-06-14T09:15:13.940Z] SyntaxError: Unexpected end of JSON input
	at JSON.parse (<anonymous>)
	at Cf (/home/aiti/.vscode/extensions/ms-vscode-remote.remote-containers-0.183.0/dist/extension/extension.js:214:1206)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async fc (/home/aiti/.vscode/extensions/ms-vscode-remote.remote-containers-0.183.0/dist/extension/extension.js:214:944)
	at async fI (/home/aiti/.vscode/extensions/ms-vscode-remote.remote-containers-0.183.0/dist/extension/extension.js:250:1129)
	at async Hz (/home/aiti/.vscode/extensions/ms-vscode-remote.remote-containers-0.183.0/dist/extension/extension.js:236:10239)
	at async UD (/home/aiti/.vscode/extensions/ms-vscode-remote.remote-containers-0.183.0/dist/extension/extension.js:236:6872)
	at async wz (/home/aiti/.vscode/extensions/ms-vscode-remote.remote-containers-0.183.0/dist/extension/extension.js:217:9939)

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.