Skip to content
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

Cannot find module 'node-linux-arm/package.json' #59

Open
brunocerk opened this issue Feb 13, 2019 · 8 comments
Open

Cannot find module 'node-linux-arm/package.json' #59

brunocerk opened this issue Feb 13, 2019 · 8 comments

Comments

@brunocerk
Copy link

Nodejs Version: v11.9.0
Platform: Linux alarmpi 4.14.97-1-ARCH #1 SMP Tue Feb 5 20:10:34 UTC 2019 armv7l GNU/Linux

How to reproduce on my system:
npm init
npm install node --save

Or npm install on any existing project

npm install node --save

node@11.9.0 preinstall /home/xxxxxx/testproject/node_modules/node
node installArchSpecificPackage

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/node-linux-arm - Not found
npm ERR! 404 
npm ERR! 404  'node-linux-arm@11.9.0' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because 
npm ERR! 404  1. name can only contain URL-friendly characters
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xxxxxx/.npm/_logs/2019-02-12T02_27_55_734Z-debug.log
internal/modules/cjs/loader.js:611
    throw err;
    ^

Error: Cannot find module 'node-linux-arm/package.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
    at Function.resolve (internal/modules/cjs/helpers.js:28:19)
    at ChildProcess.<anonymous> (/home/xxxxxx/testproject/node_modules/node-bin-setup/index.js:18:27)
    at ChildProcess.emit (events.js:197:13)
    at maybeClose (internal/child_process.js:978:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
npm WARN testproject@1.0.0 No description
npm WARN testproject@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node@11.9.0 preinstall: `node installArchSpecificPackage`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node@11.9.0 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xxxxxx/.npm/_logs/2019-02-12T02_27_55_840Z-debug.log

@sonofhammer
Copy link

sonofhammer commented Mar 6, 2019

I did a bit of digging and found the following.
instalArchSpecificPackage figures out which node-{platform}-{architecture} package to install by getting the process.platform and process.arch values from NodeJS.Process

unfortunately, process.arch only has the following possible values

'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.

The node packages that are available on npmjs.org use a different naming convention and spell out the specific architecture version node-linux-arm64 or node-linux-armv7l or node-linux-armv6l. They follow the naming convention of binaries on nodejs.org

relevant bit of code from instalArchSpecificPackage from node-bin-setup function below

  var platform = process.platform == 'win32' ? 'win' : process.platform;
  var arch = platform == 'win' && process.arch == 'ia32' ? 'x86' : process.arch;

  var cp = spawn(platform == 'win' ? 'npm.cmd' : 'npm', ['install', '--no-save', ['node', platform, arch].join('-') + '@' + version], {
    stdio: 'inherit',
    shell: true
  })

Note how there's additional handling for windows flavor of process.arch. Similar additional handling needs to be added for arm architecture.

@psycr0w13
Copy link

psycr0w13 commented May 7, 2019

Hey Guys,
I got the same problem --> I want to install my docker container which has node in its package.json on a raspbian stretch lite Raspberry Pi via yarn/npm install and get the same error:

`error /usr/src/app/node_modules/node: Command failed.
Exit code: 1
Command: node installArchSpecificPackage
Arguments:
Directory: /usr/src/app/node_modules/node
Output:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.yarnpkg.com/node-linux-arm - Not found
npm ERR! 404
npm ERR! 404 'node-linux-arm@12.1.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-05-07T08_24_01_424Z-debug.log
internal/modules/cjs/loader.js:613
throw err;
^

Error: Cannot find module 'node-linux-arm/package.json'
Require stack:

  • /usr/src/app/node_modules/node/installArchSpecificPackage.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
    at Function.resolve (internal/modules/cjs/helpers.js:21:19)
    at ChildProcess. (/usr/src/app/node_modules/node-bin-setup/index.js:18:27)
    at ChildProcess.emit (events.js:196:13)
    at maybeClose (internal/child_process.js:1000:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)`

The answer describes really nice what the problem is, but how can I solve this? I need to install node in the docker container when building it. I found a way to install node globally on my Pi, but how can I install it in my container when building it on the Pi?

It would be so great if anybody could help me.
Thank you very much in advance :)

@VadneyK
Copy link

VadneyK commented Jun 1, 2021

similar issue with M1 chip: #124

@VadneyK
Copy link

VadneyK commented Jun 4, 2021

View the solution to the similar issue: #124

@VadneyK
Copy link

VadneyK commented Jun 4, 2021

We really need this issue resolved: #126

@mdarfay
Copy link

mdarfay commented Aug 30, 2021

Any update on the issue ? Just trying to install an existing project on a Raspberry Pi 3 and got the same error (architecture being armv7l.

@e-dant
Copy link

e-dant commented Oct 9, 2021

Any updates? Making it very difficult to develop from a pi.

@StefanLobbenmeier
Copy link

Somehow there is already a discussion about this fix but not linked to here:
#57
aredridel/node-bin-setup#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants