You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
Install error: Unexpected token < in JSON at position 35 #17340
Running npm i within a certain project produces the following error.
npm ERR! Unexpected token < in JSON at position 35
From the debug.log it appears that npm is trying to read the load the shrinkwrap and failing. It's worth noting that this issue only occurs in this project on my current machine. I've tested on another Fedora 22 machine, (same npm and node versions) and the install works as expected. I appreciate this points to my local environment being the cause, however it looks like there may be some invalid syntax (<) stuck in a config file somewhere that shouldn't be there and that I am unable to clear. Here is the package.json for this project.
How can the CLI team reproduce the problem?
I'm unsure how to suggest reproduction of the issue, however I'm happy to test any suggestions anyone offers and report back.
I've just tested with some older versions of npm (v3.7.3 and v3.10.3, using nvm to switch) and the install worked as expected. Removing the node_modules directory, switching back to npm v5.0.3, and running the install again produces the same failure listed in the original issue. It looks like this could be an issue with npm v5 after all.
Reacted by Norman, Kishor Patil, Ravi, Kalana Wijesekara, Dietmar Aumann, JamesYin, Matthew Ricks, Justin Akin, Code Connoisseur | Full-Stack Dev, Hassaan Sadiq and 162 more
Reacted by AaronPelzer, Matt McElwee, Mario Zyla, Aaron Turner, DEEPAK MEENA, Semir N., Shin Nagai, Raphael, 吕蓬, Yevhen Baidiuk and 2 more
Reacted by Andrei-Mihai Nicolae, Devid, Deepak Jha, Cameron Aziz, Hunter Trawick, IPbianco, Matt McElwee, Mario Zyla, Aaron Turner, Ivanov Dmitry and 11 more
Reacted by Edgar Mejía and Henry Bergström
Reacted by Khadim Fall, Matt McElwee, Mario Zyla, Vojtěch Sedláček, Aaron Turner, Ivanov Dmitry, Pedro Martins, Semir N., Shin Nagai, Raphael and 7 more
Activity
rxgx commentedon Jun 21, 2017
What are you using to convert the
<rootDir>in"<rootDir>/__mocks__/fileMock.js"?joshfarrant commentedon Jun 21, 2017
That whole jest block is actually not used, I should have removed it from the included gist really.
Removing it from the project's
package.jsonyields the same error as described above.joshfarrant commentedon Jun 21, 2017
I've just tested with some older versions of npm (v3.7.3 and v3.10.3, using nvm to switch) and the install worked as expected. Removing the
node_modulesdirectory, switching back to npm v5.0.3, and running the install again produces the same failure listed in the original issue. It looks like this could be an issue with npm v5 after all.prathammehta commentedon Aug 3, 2017
Also,
rm package-lock.jsonworks well.iampatilkishor commentedon Aug 22, 2017
delete/rename file package-lock.json will work fine
raghuureddy commentedon Sep 3, 2017
rm package-lock.json worked.
willa01 commentedon Oct 27, 2017
rm package-lock.json在 npm install就好了
LeonDWong commentedon Jan 11, 2018
This problem still remains in npm@5.6.0, could it be fixed in upcoming version?
david95thinkcode commentedon Jan 25, 2018
@EricBeReal thanks, that's works like a charm.
Tries to fix the Travis build
nishant1528 commentedon Feb 22, 2018
simple rename package.lock to any name. After building it will create new package.lock and delete previous one
originalix commentedon Mar 6, 2018
Thank you.
rm package-lock.jsonworks well.dathobek commentedon Jun 20, 2018
rm package-lock.json works well..thanks
fengzifz commentedon Jun 21, 2018
rm package-lock.json with npm v5.6 couldn't work.
Upgrade npm to the latest version and run
npm installworks fine.