~/projects/pxt$ node --version
v18.19.1
~/projects/pxt$ npm --version
9.2.0
~/projects/pxt$ npm install
...
Installing authcode...
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/tsato/projects/pxt/built/react-common/components/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/tsato/projects/pxt/built/react-common/components/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
...
~/projects/pxt$ grep react-common authcode/package.json
"react-common": "file:../built/react-common/components",
There is no such a folder called “built” at this point.
I checked the change history of authcode/package.json. But it has been 2 years since the last change. Is there any command I should do before running npm install?
Regardless of this specific issue, there is a chicken-egg situation here. built folder is referenced by a module to be installed. But built folder is created by gulp. Yet, gulp can not be run without running npm install first because it requires local modules.
So, here’s the procedure to build a bit ugly but successfully.
pxt$ sudo npm install gulp
pxt$ npm install
this will fail because of the same error as I reported because no built folder exists
pxt$ git apply gulp_patch.diff
see below for the detail
pxt$ gulp
this will build TypeScript files but fail becuase not enough modules exist, yet
pxt$ npm install
this will succeed
pxt$ gulp
this will suceed
pxt$ gulp test
only karma fails
The patch contains a code snippet that used to generate a dummy package.json, which was removed sometime ago. Also, karma is commented out.