X-Press Publishing - Question Regarding Installing Express

Hello!

Working on the BUILDING A PERSISTENT API # X-Press Publishing-project in the Web Development Path.

I’ve extracted this project and yarn install:ed everything. However now when I try to “yarn add express”, body-parser, cors, etc it doesn’t work. This makes it so that I can’t start this project.

I don’t know how to go back to NPM, so generally I’ve just been using Yarn and it has worked out all right. I don’t know if this is an NPM/Yarn issue?

If anyone could help out here that would be greatly appreciated.

Kindly,
Dawid

1 Like

This is what it says when I do “yarn add express”:

Dawids-MacBook-Pro:capstone-project-1-x-press-publishing dawiddahl$ yarn add express
yarn add v1.17.0
info No lockfile found.
[1/4] :mag: Resolving packages…
warning mocha > json3@3.3.2: Please use the native JSON object instead of JSON 3
warning react > fbjs > core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
warning sqlite3 > node-pre-gyp > hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning sqlite3 > node-pre-gyp > hawk > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to getthe best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning sqlite3 > node-pre-gyp > hawk > boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to getthe best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning sqlite3 > node-pre-gyp > hawk > boom > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest versionto get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning sqlite3 > node-pre-gyp > hawk > cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version toget the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning sqlite3 > node-pre-gyp > hawk > cryptiles > boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning sqlite3 > node-pre-gyp > hawk > sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning sqlite3 > node-pre-gyp > hawk > sntp > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest versionto get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning sqlite3 > node-pre-gyp > request > hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning supertest > superagent@3.8.3: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a User-Agent header). This notice will go away with v5.0.2+ once it is released.
warning babel@6.23.0: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers
warning babel-preset-es2015@6.24.1: :raised_hands: Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
[2/4] :truck: Fetching packages…
[3/4] :link: Linking dependencies…
[4/4] :hammer: Building fresh packages…
[1/4] ⡀ sqlite3
[-/4] ⡀ waiting…
[-/4] ⡀ waiting…
error /Users/dawiddahl/Documents/Dawid Programming Files/Codecademy/capstone-project-1-x-press-publishing/node_modules/sqlite3: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /Users/dawiddahl/Documents/Dawid Programming Files/Codecademy/capstone-project-1-x-press-publishing/node_modules/sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.39
node-pre-gyp info using node@10.15.1 | darwin | x64
node-pre-gyp info check checked for “/Users/dawiddahl/Documents/Dawid Programming Files/Codecademy/capstone-project-1-x-press-publishing/node_modules/sqlite3/lib/binding/node-v64-darwin-x64/node_sqlite3.node” (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-darwin-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.15.1 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.15.1 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http Connection closed while downloading tarball file
internal/modules/cjs/loader.js:583
throw err;
^

Error: Cannot find module ‘graceful-fs’
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:12:10)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute ‘/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean’ (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/dawiddahl/Documents/Dawid Programming Files/Codecademy/capstone-project-1-x-press-publishing/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:189:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Darwin 18.6.0
node-pre-gyp ERR! command “/usr/local/bin/node” “/Users/dawiddahl/Documents/Dawid Programming Files/Codecademy/capstone-project-1-x-press-publishing/node_modules/sqlite3/node_modules/.bin/node-pre-gyp” “install” “–fallback-to-build”
node-pre-gyp ERR! cwd /Users/dawiddahl/Documents/Dawid Programming Files/Codecademy/capstone-project-1-x-press-publishing/node_modules/sqlite3
node-pre-gyp ERR! node -v v10.15.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute ‘/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean’ (1)
internal/modules/cjs/loader.js:583
throw err;
^

Error: Cannot find module ‘graceful-fs’
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:12:10)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)

@dawiddahl3494864223, I have the same error. Were you able to resolve? I’ve tried updating dependencies, updating gRPC, re-running the install, tried installing just from source and for the life of me, I can’t figure this out.

I managed to kinda make it work, the terminal will still have some warnings and I am using npm, but after i downloanded and installed the python 2.7.15(at the default path) and sqlite3 from the GitHub’s master branch: npm install https://github.com/mapbox/node-sqlite3/tarball/master, I had no more errors.

I hope this helps, and be sure the python path is the required one(it will show it in the error).

Yes, I’m happy to say I found the solution and am using NPM again. So happy!

First I reinstalled Node. Then when that didn’t work, I did this:

“Restore ownership of the user’s npm related folders, to the current user, like this:

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config”

I hope it will work for you, too!

1 Like

Sadly, it did not. Thank you for sharing though! I thought we had the same error, it appeared that way at first. But, I’ve been digging into my log and noticed a few other issues too. Like somehow xcode was missing from my machine. I just installed it in Aug when I picked dev training back up…so I’m puzzled by that one.

I think I will try loading up an older version of node and see if that helps. I came across a forum that said the version of sqlite3 we’re to use doesn’t support v10.xx of Node. Here’s the article for reference: https://github.com/mapbox/node-sqlite3/issues/918

To circle back here, I had some permission issues from when I first installed node (pre codecademy and was instructed to use sudo - gasp, I know!), but they were uncovered when I tried to rollback to node v9. I reinstalled Node via Homebrew to correct permissions and also cleaned up my files. Rolled back to node 9 successfully and then ran npm install for the project and all is well. Just wanted to post the solution to resolve in case there are others in a similar situation.

1 Like

Awesome! Glad to hear you managed to figure it out as well!