Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript-node npm scripts error access #240

Closed
DevinsonAlvarez opened this issue Feb 16, 2024 · 1 comment
Closed

typescript-node npm scripts error access #240

DevinsonAlvarez opened this issue Feb 16, 2024 · 1 comment

Comments

@DevinsonAlvarez
Copy link

Hi, I'm trying build a typescript-node container but when I using npm install or npm run dev throws the next errors:

$ npm install
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /workspaces/react-app/node_modules/@esbuild/aix-ppc64
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/workspaces/react-app/node_modules/@esbuild/aix-ppc64'
npm ERR!  [Error: EACCES: permission denied, mkdir '/workspaces/react-app/node_modules/@esbuild/aix-ppc64'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/workspaces/react-app/node_modules/@esbuild/aix-ppc64'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
$ npm run dev

> react-app@0.0.0 dev
> vite

failed to load config from /workspaces/react-app/vite.config.ts
error when starting dev server:
Error: EACCES: permission denied, open '/workspaces/react-app/vite.config.ts.timestamp-1708117025459-8405b36e7d40a.mjs'

This error solves when I run as root using sudo npm install/run dev but I thing it is not the best idea to always run these commands as root. This is my .devcontainer file:

{
  "name": "React App",
  "image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",

  "forwardPorts": [5173],

  "runArgs": ["--name", "react-app-devcontainer"],

  "postCreateCommand": "npm install",

  "customizations": {
    "vscode": {
      "extensions": [
        "dsznajder.es7-react-js-snippets",
        "esbenp.prettier-vscode",
        "dbaeumer.vscode-eslint",
        "ms-vscode.vscode-typescript-next"
      ]
    }
  }
}
@DevinsonAlvarez
Copy link
Author

The error happened because I build the contrainer from WSL and the permissions were not assigned to the node user, I solved it by changing the owner on folder using sudo chown -R $USER . && npm install. This problem only happened while using WSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant