solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

Error in npm workspaces monorepo

Open cician opened this issue 3 years ago • 2 comments

Hi I'm trying out Solid Start (and solid) to get a feeling of the framework.

When building or starting the dev server from an npm workspaces monorepo i get this error:

cician@ciciomp:/tmp/solid-start-ws/packages/site$ npm run build

> build
> solid-start build

 solid-start build 
 version  0.2.5
failed to load config from /tmp/solid-start-ws/packages/site/vite.config.ts
node:fs:1438
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, scandir 'node_modules'
    at Object.readdirSync (node:fs:1438:3)
    at detectAdapter (file:///tmp/solid-start-ws/node_modules/solid-start/vite/plugin.js:555:6)
    at solidStart (file:///tmp/solid-start-ws/node_modules/solid-start/vite/plugin.js:590:72)
    at file:///tmp/solid-start-ws/packages/site/vite.config.ts.timestamp-1668372870119.mjs:5:13 {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: 'node_modules'
}
npm ERR! Lifecycle script `build` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: site 
npm ERR!   at location: /tmp/solid-start-ws/packages/site 

Reproduction:

mkdir solid-start-ws
cd solid-start-ws
echo "{\"workspaces\": [\"./packages/*\"]}" > ./package.json
mkdir packages
mkdir packages/site
cd packages/site
npm init solid
# chose bare, ssr=false and ts=true
npm install
npm run build

Builds and runs fine in a simple project without npm workspaces so for now I'll just continue with a simpler setup or a workaround.

Thanks and keep up with the good work.

cician avatar Nov 13 '22 21:11 cician

I got around it by manually creating an empty node_modules folder...

tomexx avatar Nov 20 '22 22:11 tomexx

Also running into this issue in an nx monorepo when trying to run the build command. Have used patch package with the changes from #435 for now, seems to fix the issue.

mmhand123 avatar Dec 06 '22 13:12 mmhand123