-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[BUG] npm ERR! Cannot read properties of null (reading 'package') #4787
Comments
This is frustrating because I can look at the log and find out the call stack, but it doesn't help me in fixing the problem. I accept that it's my error, but it would save many hours if there were more information about the source of the error. In my case, I get The line
hints at the problem but it works in other contexts |
+1 |
+1 |
Any update on this issue? I'm facing this issue |
+1 |
same |
128 verbose node v16.15.1 Same here while running npm link. |
Node 16.16 and Npm 8.11 and 8.15 too Show log0 verbose cli C:\Users\Helldar\AppData\Local\nvs\default\node.exe C:\Users\Helldar\AppData\Local\nvs\default\node_modules\npm\bin\npm-cli.js
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 3ms
5 timing config:load:file:C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:D:\domains\volunteers\web\.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:C:\Users\Helldar\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\Helldar\AppData\Local\nvs\default\etc\npmrc Completed in 1ms
14 timing config:load:global Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 9ms
19 timing npm:load:configload Completed in 9ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm i
23 verbose argv "i"
24 timing npm:load:setTitle Completed in 1ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 3ms
27 verbose logfile logs-max:10 dir:C:\Users\Helldar\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\Helldar\AppData\Local\npm-cache\_logs\2022-07-24T10_07_31_732Z-debug-0.log
29 timing npm:load:logFile Completed in 3ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 17ms
33 timing arborist:ctor Completed in 0ms
34 silly logfile start cleaning logs, removing 1 files
35 silly logfile done cleaning log files
36 timing arborist:ctor Completed in 0ms
37 timing idealTree:init Completed in 9ms
38 timing idealTree:userRequests Completed in 0ms
39 silly idealTree buildDeps
40 silly fetch manifest @cloudgeek/vue3-video-player@^0.3.10
41 http fetch GET 200 https://registry.npmjs.org/@cloudgeek%2fvue3-video-player 300ms (cache miss)
42 silly fetch manifest @mdi/font@^6.2.0
43 http fetch GET 200 https://registry.npmjs.org/@mdi%2ffont 128ms (cache miss)
44 silly fetch manifest apexcharts@^3.35.3
45 http fetch GET 200 https://registry.npmjs.org/apexcharts 64ms (cache miss)
46 silly fetch manifest axios@^0.27.2
47 http fetch GET 200 https://registry.npmjs.org/axios 45ms (cache miss)
48 silly fetch manifest laravel-vue-i18n@^2.1.1
49 http fetch GET 200 https://registry.npmjs.org/laravel-vue-i18n 47ms (cache miss)
50 silly fetch manifest laravel-mix@^6.0.43
51 http fetch GET 200 https://registry.npmjs.org/laravel-mix 57ms (cache miss)
52 silly fetch manifest postcss@^8.4.14
53 http fetch GET 200 https://registry.npmjs.org/postcss 43ms (cache miss)
54 silly fetch manifest lodash@^4.17.21
55 http fetch GET 200 https://registry.npmjs.org/lodash 58ms (cache miss)
56 silly fetch manifest maska@^1.5.0
57 http fetch GET 200 https://registry.npmjs.org/maska 39ms (cache miss)
58 silly fetch manifest moment@^2.29.3
59 http fetch GET 200 https://registry.npmjs.org/moment 51ms (cache miss)
60 silly fetch manifest moment-duration-format@^2.3.2
61 http fetch GET 200 https://registry.npmjs.org/moment-duration-format 54ms (cache miss)
62 silly fetch manifest moment-timezone@^0.5.34
63 http fetch GET 200 https://registry.npmjs.org/moment-timezone 58ms (cache miss)
64 silly fetch manifest pinia@^2.0.14
65 http fetch GET 200 https://registry.npmjs.org/pinia 51ms (cache miss)
66 silly fetch manifest @vue/composition-api@^1.4.0
67 http fetch GET 200 https://registry.npmjs.org/@vue%2fcomposition-api 152ms (cache miss)
68 silly fetch manifest vue@^3.2.25
69 http fetch GET 200 https://registry.npmjs.org/vue 69ms (cache miss)
70 silly fetch manifest vue@>= 2.5 < 2.7
71 silly fetch manifest typescript@^4.5.4
72 http fetch GET 200 https://registry.npmjs.org/typescript 142ms (cache miss)
73 silly fetch manifest pinia-plugin-persistedstate@^1.6.3
74 http fetch GET 200 https://registry.npmjs.org/pinia-plugin-persistedstate 45ms (cache miss)
75 silly fetch manifest query-string@^7.1.1
76 http fetch GET 200 https://registry.npmjs.org/query-string 41ms (cache miss)
77 silly fetch manifest roboto-fontface@*
78 http fetch GET 200 https://registry.npmjs.org/roboto-fontface 42ms (cache miss)
79 silly fetch manifest vue-router@^4.0.16
80 http fetch GET 200 https://registry.npmjs.org/vue-router 54ms (cache miss)
81 silly fetch manifest vue-toastification@^2.0.0-rc.5
82 http fetch GET 200 https://registry.npmjs.org/vue-toastification 47ms (cache miss)
83 silly fetch manifest vue3-apexcharts@^1.4.1
84 http fetch GET 200 https://registry.npmjs.org/vue3-apexcharts 42ms (cache miss)
85 silly fetch manifest vue3-audio-player@^1.0.5
86 http fetch GET 200 https://registry.npmjs.org/vue3-audio-player 42ms (cache miss)
87 silly fetch manifest vue3-openlayers@^0.1.68
88 http fetch GET 200 https://registry.npmjs.org/vue3-openlayers 48ms (cache miss)
89 silly fetch manifest vue3-telegram-login@^0.0.4
90 http fetch GET 200 https://registry.npmjs.org/vue3-telegram-login 48ms (cache miss)
91 silly fetch manifest vuetify@^3.0.0-beta.5
92 http fetch GET 200 https://registry.npmjs.org/vuetify 62ms (cache miss)
93 silly fetch manifest @formatjs/intl@^1.0.0 || ^2.0.0
94 http fetch GET 200 https://registry.npmjs.org/@formatjs%2fintl 157ms (cache miss)
95 silly fetch manifest vite-plugin-vuetify@^1.0.0-alpha.0
96 http fetch GET 200 https://registry.npmjs.org/vite-plugin-vuetify 62ms (cache miss)
97 silly fetch manifest [email protected]
98 silly fetch manifest vite@^2.9.9
99 http fetch GET 200 https://registry.npmjs.org/vite 75ms (cache miss)
100 silly fetch manifest less@*
101 http fetch GET 200 https://registry.npmjs.org/less 49ms (cache miss)
102 silly fetch manifest sass@^1.53.0
103 http fetch GET 200 https://registry.npmjs.org/sass 53ms (cache miss)
104 silly fetch manifest stylus@*
105 http fetch GET 200 https://registry.npmjs.org/stylus 57ms (cache miss)
106 silly fetch manifest vue-i18n@^9.0.0
107 http fetch GET 200 https://registry.npmjs.org/vue-i18n 54ms (cache miss)
108 silly fetch manifest [email protected]
109 http fetch GET 200 https://registry.npmjs.org/webpack-plugin-vuetify 77ms (cache miss)
110 silly fetch manifest @vue/compiler-sfc@^3.2.6
111 http fetch GET 200 https://registry.npmjs.org/@vue%2fcompiler-sfc 74ms (cache miss)
112 silly fetch manifest webpack@^5.0.0
113 http fetch GET 200 https://registry.npmjs.org/webpack 124ms (cache miss)
114 silly fetch manifest webfontloader@^1.0.0
115 http fetch GET 200 https://registry.npmjs.org/webfontloader 49ms (cache miss)
116 silly fetch manifest @babel/core@^7.18.6
117 http fetch GET 200 https://registry.npmjs.org/@babel%2fcore 57ms (cache miss)
118 silly fetch manifest @babel/plugin-proposal-class-properties@^7.18.6
119 http fetch GET 200 https://registry.npmjs.org/@babel%2fplugin-proposal-class-properties 52ms (cache miss)
120 silly fetch manifest @babel/plugin-proposal-optional-chaining@^7.18.6
121 http fetch GET 200 https://registry.npmjs.org/@babel%2fplugin-proposal-optional-chaining 58ms (cache miss)
122 silly fetch manifest @popperjs/core@^2.11.5
123 http fetch GET 200 https://registry.npmjs.org/@popperjs%2fcore 89ms (cache miss)
124 silly fetch manifest @types/lodash@^4.14.182
125 http fetch GET 200 https://registry.npmjs.org/@types%2flodash 63ms (cache miss)
126 silly fetch manifest @types/node@^18.0.5
127 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 69ms (cache miss)
128 silly fetch manifest @types/webfontloader@^1.0.0
129 http fetch GET 200 https://registry.npmjs.org/@types%2fwebfontloader 66ms (cache miss)
130 silly fetch manifest @vitejs/plugin-vue@^2.3.3
131 http fetch GET 200 https://registry.npmjs.org/@vitejs%2fplugin-vue 89ms (cache miss)
132 silly fetch manifest autoprefixer@^10.4.7
133 http fetch GET 200 https://registry.npmjs.org/autoprefixer 56ms (cache miss)
134 silly fetch manifest eslint@^8.18.0
135 http fetch GET 200 https://registry.npmjs.org/eslint 48ms (cache miss)
136 silly fetch manifest eslint-plugin-prettier@^4.2.1
137 http fetch GET 200 https://registry.npmjs.org/eslint-plugin-prettier 59ms (cache miss)
138 silly fetch manifest prettier@>=2.0.0
139 http fetch GET 200 https://registry.npmjs.org/prettier 63ms (cache miss)
140 silly fetch manifest eslint-plugin-you-dont-need-lodash-underscore@^6.12.0
141 http fetch GET 200 https://registry.npmjs.org/eslint-plugin-you-dont-need-lodash-underscore 45ms (cache miss)
142 silly fetch manifest postcss-import@^14.1.0
143 http fetch GET 200 https://registry.npmjs.org/postcss-import 42ms (cache miss)
144 silly fetch manifest vite@^2.7.0
145 silly fetch manifest sass@*
146 silly fetch manifest vuetify@^3.0.0-beta.4
147 silly fetch manifest typescript@^4.5
148 silly fetch manifest vue@^3.2.0
149 timing idealTree Completed in 3734ms
150 timing command:i Completed in 3743ms
151 verbose stack TypeError: Cannot read properties of null (reading 'explain')
151 verbose stack at Arborist.[explainPeerConflict] (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1434:29)
151 verbose stack at Arborist.[failPeerConflict] (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1427:44)
151 verbose stack at Arborist.[loadPeerSet] (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1394:34)
151 verbose stack at async Arborist.[buildDepStep] (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:976:11)
151 verbose stack at async Arborist.buildIdealTree (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:218:7)
151 verbose stack at async Promise.all (index 1)
151 verbose stack at async Arborist.reify (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:153:5)
151 verbose stack at async Install.exec (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\lib\commands\install.js:156:5)
151 verbose stack at async module.exports (C:\Users\Helldar\AppData\Local\nvs\node\16.16.0\x64\node_modules\npm\lib\cli.js:78:5)
152 verbose cwd D:\domains\volunteers\web
153 verbose Windows_NT 10.0.22000
154 verbose node v16.16.0
155 verbose npm v8.11.0
156 error Cannot read properties of null (reading 'explain')
157 verbose exit 1
158 timing npm Completed in 3831ms
159 verbose unfinished npm timer reify 1658657251816
160 verbose unfinished npm timer reify:loadTrees 1658657251822
161 verbose unfinished npm timer idealTree:buildDeps 1658657251833
162 verbose unfinished npm timer idealTree:#root 1658657251833
163 verbose code 1
164 error A complete log of this run can be found in:
164 error C:\Users\Helldar\AppData\Local\npm-cache\_logs\2022-07-24T10_07_31_732Z-debug-0.log |
This problem is super frustrating. I'm trying to get the package updated upstream, so that I no longer have a local file dependency, but that is taking a long time as well. Kind of surprised that more folks haven't been having this issue, which would give it more attention. Worth noting that I've been playing with pnpm recently, which does not have this issue and also has a lot of good features. However, I did find some local relative path dependencies inside my tarball dep. That forced me to adjust to regular npm repo deps and rebuild the tarball, but that was pretty easy. Generally speaking, I'd love to just use npm straight up, but I may bite the bullet and start using pnpm (with shamefully-hoist :P for the time being). Happy to re-test this when things are fixed though. |
downgrade your node to 16.0, npm to 7+. this workes for me |
Mine is this error:
I have even uninstalled Node and reinstalled it. Same issue |
@AnatuGreen Can you try to install the dependencies from a terminal that opened with Rosetta (if you're using MacBook with M1 chip) |
I downgraded NPM to version 7 and the error stopped.
…On Mon, 15 Aug 2022, 10:27 am Ahmed Zaki, ***@***.***> wrote:
@AnatuGreen <https://github.com/AnatuGreen> Can you try to install the
dependencies from a terminal that opened with Rosetta
use node v16.16.0
npm v8
—
Reply to this email directly, view it on GitHub
<#4787 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWW3LQHW3O663THHU6VQXWTVZIEPTANCNFSM5T537F3A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
As an FYI, my workaround is to delete or rename node_modules and then let npm install recreate it. I suspect problems in handling symlinks on Windows. |
none of above Works |
I have to install everything with --legacy-peer-deps |
downgrade to [email protected] fixed the issue. Just for the records I was using v8.19.2. |
For those who have not found any of the previously mentioned solutions useful I found that adding a In my case I had a npm linked package in the package-lock that should have referenced the npm deployment of that dependency instead. |
This happens if I use If I instead link the package names, building my dependent project gives errors like Node v16.18.1 npm 9.1.2 |
I was having the similar issue my npm version was 8.19.2 upgrading to latest version, which was 9.2.0 at the time I was writing this, resolved this issue |
Same as above but 9.2.0 did not resolve it |
I get this when using npm workspaces. |
上面的办法我都试了,可还是不能解决这个问题 |
I have upgraded to Node v18.13.0 and npm 9.3.1 but still hit this issue I no longer get a different error when symlinking the directory like
This had no effect |
Deleting |
+1 downgrade npm to 8.1.0 worked for me |
+1 |
+1 Prompt: npm install styled-components
2023-05-09T11_02_05_183Z-debug-0.log EDIT: downgrade to 8.1.0 didn't work. I needed to downgrade to 7.7.6 |
even I am having the same error while installing styled components. |
try this --> npm install [email protected] it works :-) |
npm install styled-components@latest <--- worked for me |
I tried delete package-lock.json and npm install again, Solved my problem. |
it should be |
I encountered this error when using Solution: When you initially run If you need to run a. First, you should unlink the package using b. After unlinking, you can run |
I just encountered this issue with npm 10.1.0. I didn't try downgrading to 9.0. This is the error
In my case, I deleted I'm also using Lerna, but I haven't had this issue before. Many people above said this has to do with linked dependencies, and Lerna is in fact linking dependencies from all of my git submodules together. So it seems that linking might have to do with the issue. |
In a project that's a git submodule and workspace in a parent repo, I had to delete I'm guessing this means that running plain This is painful. Really hoping this can be fixed. |
…rettier' * remove-global-builds-switch-to-web-test-runner-update-prettier: (29 commits) feat: fallback to loading jest globals in test-runner from the hoisted node_modules location if it is not located in lume/cli's node_modules BREAKING: add a check to ensure that the repo is not modified before versioning during release. Repo author should be sure to commit build outputs, or fix the build so no changes happen during build that are not tracked. undo testing in firefox and safari for now, some lume code needs fixing BREAKING: besides Chromium, also run tests in Firefox and Safari in CI. Migration: If you didn't test those browsers before, you might have to update any code that is not compatible. Alternatively, make sure there is no CI env var set and it will test in Chrome only. update test-runner port range to avoid ports denylisted by Chrome install web test-runner's playwright launcher, and use that to run tests in Chrome in CI run tests on a random port to avoid collisions when running tests in parallel for multiple projects at the same time BREAKING: migrate from Karma to `@web/test-runner`. This removed a lot of dependencies (namely Webpack needed for the Karma setup), greatly reduces maintenance burden, speeds tests up, provides a much simpler and better test development and debugging experience with minimal configuration compared to with Karma, and ensures longevity of test code by ensuring that they run as standard JavaScript modules. 🎉 The `webpackConfigs` and `testSpecFormat` options for `lume.config.cjs` have been removed. Migration: Delete any webpack configs, all code should be vanilla JavaScript (ES) modules. There is only one test spec format now (Mocha `describe()`/`it()` and Jest `expect()`). Test syntax is mostly the same, and most tests will remain as-is. A few things need to be changed from Jasmine's `expect()` API to Jest's very similar `expect()` API. For example, `expect(true).toBeTrue()` needs to be changed to `expect(true).toBe(true)`. `jasmine.*` API is removed, f.e. `jasmine.createSpy` can be replaced with `sinon.spy()`. Try running tests, see what broke, then look up the way to do it with Jest or with Sinon, etc. Also tests are executed as vanilla ES Modules in a browser, and an `importMap` field will need to be defined in `lume.config.js` to handle bare specifiers (f.e. the `foo` in `import something from 'foo'`). Only ES Modules are supported, so if any libraries are CommonJS, those will not work and alternatives will be needed. The CLI can be forked though, and `@web/test-runner`'s config can be expanded to use its built-in `esbuild` plugin, along with Rollup plugins for any non-vanilla-ESM use cases. BREAKING: instead of trying to stash changes and continuing with versioning and publishing, exit non-zero if the working directory is dirty. Migration: clear your git repo of changes, then try again. update version scripts to avoid an issue with workspaces and linked dependencies (npm/cli#5687, npm/cli#4787) BREAKING: remove the global build feature, from now on we output and publish only JS modules for simplicity. Migration: @lume/cli will no longer output global.js files for use with non-module script tags, instead any code depending on your @lume/cli-managed package should use `import` syntax to import your package. port karma bash script to Node so it works in Windows too ensure line endings match with the rest of our tooling (all work in LF) ensure that we also get tsc, babel, and prettier bins with Node module lookup to avoid relying on PATH (Yarn and NPM set PATH differently, see Yarn issue 5800) update exec calls to find binaries using node_module resolution instead of relying on PATH to prevent cross-platform issues with Windows, and make the noFailOnError option use || echo '' instead of || true for cross-platform support prevent duplicate solid-js libs. Its ok to hard code this one case, because solid-js is a key dependency of lume Avoid error with fs.mkdir if dir already exists. Why is it so difficult? ensure dist/ is created before we copy assets to hopefully solve a problem with this in Windows CI (https://github.com/lume/lume/actions/runs/6519881972/job/17706893670) update prettier to 3.0.3 infra: add .gitattributes with rules to enforce that code is checked out with LF line endings only, which prevents Prettier from failing in Windows ...
This is still happening in Windows but not DSL. How can I trace it down? The problem shows up long after the root cause making it hard for me to trace the problem back. npm versions |
If this does not resolve it, also deleting the package.lock.json resolves it, it seems also to be related by a package.lock.json that is not matching the current dependency tree in relation with symlinks |
Node.js: 20.12.1 $ npm cache clean --force
(output omitted)
$ rm -rf node_modules
$ rm package-lock.json
$ npm i
npm error Cannot read properties of null (reading 'package') No luck, much easier to switch to pnpm. |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I do an initial npm install, which works fine. Subsequent runs result in the error:
Expected Behavior
npm install not failing with the above error.
Steps To Reproduce
Environment
Starting with NPM v8.6.0 (8.5.5 does not have this issue)
Config
A package.json with a tgz file dependency. Example:
Run
npm i
Error
Environment
The text was updated successfully, but these errors were encountered: