Can't add internal package (Error: 404 Not Found) using latest Lerna (v3.16.4)
See original GitHub issueI can’t add internal package using these commands (I tried all of them). I issue these commands in the root of monorepo. Yarn version is 1.17.3:
lerna add accounting-logic@0.0.0 --scope=web-server --no-bootstrap
lerna add accounting-logic@0.0.0 --scope=web-serve
lerna add accounting-logic@0.0.0 --scope=web-server --exact
lerna add packages/accounting-logic --scope=web-server --exact
lerna add accounting-logic --scope=web-server --exact
My repository has all packages in packages
directory.
The packages/accounting-logic has this package.json:
{
"name": "domain",
"version": "0.0.0",
"private": true,
"description": "",
"author": "",
"homepage": "",
"license": "ISC",
"scripts": {
"test": "NODE_LOG_LEVEL=fatal NODE_ENV=test mocha --opts mocha.opts ./src/**/*-test.ts",
"lint": "tslint -p tsconfig.json -c tslint.json",
"check": "yarn run lint && yarn run test"
},
"workspaces": {
"nohoist": [
"jsdom",
"ws",
"@types/node",
"@types/jsdom"
]
},
"dependencies": {
"@types/node": "11.13.5",
"currency.js": "1.2.2"
},
"devDependencies": {
"mocha": "5.2.0",
"ts-node": "8.1.0"
}
}
The packages/web-server package.json is much longer but I assure you it has its private:true
property and workspaces looks like this:
"workspaces": {
"nohoist": [
"**"
]
},
Expected Behavior
I should be able to add link to the accounting-logic
Current Behavior
lerna notice cli v3.16.4
lerna ERR! Error: 404 Not Found - GET https://registry.npmjs.org/accounting-logic - Not found
lerna ERR! at res.buffer.catch.then.body (/home/user/workspace/project/node_modules/@evocateur/npm-registry-fetch/check-response.js:104:15)
lerna ERR! lerna 404 Not Found - GET https://registry.npmjs.org/accounting-logic - Not found
lerna.json
{
"packages": [
"packages/*"
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.0.0"
}
lerna-debug.log
0 silly argv { _: [ 'add' ],
0 silly argv scope: 'web-server',
0 silly argv exact: true,
0 silly argv E: true,
0 silly argv globs: [],
0 silly argv lernaVersion: '3.16.4',
0 silly argv '$0': '/home/user/workspace/project/node_modules/.bin/lerna',
0 silly argv pkg: 'accounting-logic' }
1 notice cli v3.16.4
2 verbose rootPath /home/user/workspace/project
3 error Error: 404 Not Found - GET https://registry.npmjs.org/accounting-logic - Not found
3 error at res.buffer.catch.then.body (/home/user/workspace/project/node_modules/@evocateur/npm-registry-fetch/check-response.js:104:15)
Context
I can’t proceed with development, I can’t make accounting-logic package a dependency for web-server package.
Your Environment
Linux Ubuntu 18.04
Executable | Version |
---|---|
lerna --version |
v3.16.4 |
npm --version |
n/a |
yarn --version |
1.17.3 |
node --version |
v10.16.2 |
OS | Version |
---|---|
Ubuntu | 18.04 |
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Lerna fails with 404 when trying to link dependency
I have checked all my package.json file and they marry-up to the dependency version. I am not using a caret either. However, I...
Read more >Publish Multiple Gatsby Sites in a Monorepo, Using Lerna ...
Navigate inside of the lerna-monorepo-starter directory and install the packages by running yarn . Once your packages have installed, ...
Read more >Publish Multiple Gatsby Sites in a Monorepo, Using Lerna ...
With monorepos the code is split into specific packages (aisles). Meaning you can easily navigate the project to find the component or module ......
Read more >Lerna http fetch put 404 - Feuerwehrmusikzug Dorste
Introduction to a monorepo with Lerna and Yarn workspaces, API with NestJS #60. ... add internal package (Error: 404 Not Found) using latest...
Read more >Lerna Add Will Not Add Internal Dependencies - ADocLib
Did you try adding RUN npm install before your RUN lerna bootstrap ? ... Can't add internal package Error: 404 Not Found using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Soooo… The problem was that package.json of accounting-logic had bad value in “name” field. It should be equal to the name of the directory (which is accounting-logic). IMHO this is the flaw in Lerna. This tool should analyze configuration and propose the correction. The error which appeared on the screen didn’t say exactly what was wrong (the missing package in npmjs registry was not the true error from the point of user). So if I could propose some good behavior for Lerna, to make user experience better, Lerna should compare “name” fileds and directory names, and if they are not equal, prompt user for correction.
I had the same problem but in my case, I forgot to add the new folder in the workspaces. Could help someone 😃
i.e.
"workspaces": { "packages": [ "packages/**" ] },